Are the function calls in your APIs individually orthogonal, or
do they have too many magic flags and mode bits that have a single call doing
multiple tasks? Avoiding mode flags entirely can lead to a cluttered
API with too many nigh-identical functions, but the obverse error (lots of
easily-forgotten and confusable mode flags) is even more common.
Are there a handful of prominent data structures or a single
global scoreboard that captures the high-level state of the system?
Is this state easy to visualize and inspect, or is it diffused among
many individual global variables or objects that are hard to
find?
Is there a clean, one-to-one mapping between data structures
or classes in your program and the entities in the world that they
represent?
Is it easy to find the portion of the code responsible for any
given function? How much attention have you paid to the readability
not just of individual functions and modules but of the whole codebase?
Does the code proliferate special cases or avoid them? Every
special case could interact with every other special case; all those
potential collisions are bugs waiting to happen. But even more
importantly, special cases make the code harder to understand.
How many magic numbers (unexplained constants) does the code have in
it? Is it easy to discover the implementation's limits (such as
critical buffer sizes) by inspection?
It's best for code to be simple. But if it answers these sorts
of questions well, it can be very complex without putting an
impossible cognitive burden on a human maintainer.
The reader might find it instructive to compare these with our
checklist questions about modularity in Chapter4.
[an error occurred while processing this directive]