Thanks Leo. I enjoyed reading your subtle jab at the posters in this
newsgroup. Most of us, at one time or another, are prone to be a
the point was that 7 was a limit for the discrimination of
unidimensional stimuli (pitches, loudnesses, brightnesses, etc.) and
also a limit for immediate recall, neither of which has anything to do
with a person's capacity to comprehend printed text.
So, the code deserves a separate study.
But if we consider debugging and reading the code....
For code to be reviewable, the 7+-2 rule is required. (the reader must
reconstruct all relations)
(NOTE: 7+-2 relations between items rather than items themselves)
YES, THAT IS IT: the relations between code items ARE UNWRITTEN.
One has to reconstruct them each time reading the code.
For code to be just readable, 7+-2 is not required.
In particular, if the code already works, you do not need to refactor
But if the code has not yet been debugged, it is meaningful to break it
into smaller parts.
(And it is meaningful to postpone refactoring till the moment it will
be really needed,
unless you feel that you still remember how the code works and it will
not be true later.)