Chapter 4: The Write Stuff

Mull It Over

  1. 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.

  1. We should ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.