Code layout and debugging time

Colin Percival colin.percival at wadham.ox.ac.uk
Tue Apr 22 09:22:24 PDT 2003


At 14:29 22/04/2003 +0100, Jonathon McKitrick wrote:
>I was just reading an interesting statement in Code Complete:
>
>"Although this particular statistic may be hard to put to work, a study by
>Gorla, Benander, and Benander found that the optimal number of blank lines
>in a program is about 8 to 16 percent.  Above 16 percent, debug time
>increases dramatically (1990)."
>
>Doesn't this seem to contradict the idea that clear, well-formatted code
>with lots of blank lines is easier to read and understand?  How could
>debugging be any different?

   On older systems, the time necessary for scrolling around could make a 
significant contribution (remember, that study was in 1990 -- things may 
have changed since then).
   Another possibility, however, is that introducing too many

blank lines breaks

up the code in

a manner which impairs

readability, causing people to lose time re-reading a block of code several 
times.  It would be interesting to see if a similar effect can be observed 
in heavily commented code; I have a feeling that one might find that 
writing comments into a distinct "documentation" file would have an 
advantage over the usual practice of writing comments in the middle of code.

Colin Percival



More information about the freebsd-chat mailing list