Coding for Modularity

Modularity is expressed in good code, but it primarily comes from good design. Here are some questions to ask about any code you work on that might help you improve its modularity:

You might find it instructive to compare these with our checklist of questions about transparency, and discoverability in Chapter 6.

[48] Globals also mean your code cannot be reentrant; that is, multiple instances in the same process are likely to step on each other.

[49] Many years ago, I learned from Kernighan & Plauger's The Elements of Programming Style a useful rule. Write that one-line comment immediately after the prototype of your function. For every function, without exception.

[50] A cheap way to collect this information is to analyze the tags files generated by a utility like etags(1) or ctags(1).