Subject: Re: Time to update KNF?
To: Mike Cheponis <mac@Wireless.Com>
From: Allen Briggs <briggs@ninthwonder.com>
List: tech-kern
Date: 01/19/2000 14:44:44
> What I fail to understand is that if we have data that supports that 2-4
> space indents produces more comprehensible code, and we believe that more
> comprehensible code leads to fewer errors, less time understanding the code,
> and a generally more robust system, why don't we do it?
What I've read of the discussion (including your transcription of the
article cited in _Code Complete_) says that the most comprehensible code
is:
a) indented in a way that the reader is used to, and
b) consistent.
I expect that placement of {} and () is as important as indentation.
Conventional wisdom says that code formatting is a personal preference
thing and that different people can read and understand code better in
different formats. This may not be true, and there are certainly
formats that obfuscate code, but in general, I buy into it).
To rephrase your statements quoted above:
> We have data that supports that 2-4 space indents produces more
> comprehensible code for some people under some circumstances, and
> we believe that more comprehensible code leads to fewer errors,
> less time understanding the code, and a generally more robust system.
The problem is "for some people under some circumstances."
If you reformat everything to a 2-level indent (and possibly also do
work with the semicolon placement in for-loops, change the () or {}
placement, etc.), then you'll make the code less comprehensible to
others.
Again, the best solution is probably to have an editor that formats to
your preference upon loading and reformats to KNF on output. If that's
possible to do properly.
-allen