Chapter 4: The Write Stuff
Mull It Over
Grouping related code will make its relationships clear. How can we perform this grouping? Which methods document the relationships most strongly?
Obvious grouping devices are common name prefixes and suffixes; filesystem location; and putting items in the same class or structure, C++/C# namespace, Java package, source file, or code library. Can you think of more?
Relationships enforced by the language are the strongest—both obvious to read and also automatically checked for you. However, proximity of code layout is a more potent association than you’d think. Ordering also implies a lot—you’ll think that the first item is more important than subsequent items. Exploit these facts to document your code.
We should ...
Get Code Craft now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.