tabs do WHAT?
JamesL at Lugoj.Com
Tue Feb 1 00:46:54 EST 2000
Gerrit Holl wrote:
> Brett g Porter wrote on 949330467:
> > "Thomas Wouters" <thomas at xs4all.net> wrote in message
> > news:20000131153329.B19725 at xs4all.nl...
> > > """
> > > Tabs are 8 characters, and thus indentations are also 8 characters.
> > > There are heretic movements that try to make indentations 4 (or even 2!)
> > > characters deep, and that is akin to trying to define the value of PI to
> > > be 3.
> > >
> > > Rationale: The whole idea behind indentation is to clearly define where
> > > a block of control starts and ends. Especially when you've been looking
> > > at your screen for 20 straight hours, you'll find it a lot easier to see
> > > how the indentation works if you have large indentations.
> > >
> > ...except that studies of actual human programmers say otherwise. From Steve
> > McConnell's "Code Complete" (pp 409-410):
> > "The same study ['Program Indention and Comprehensibility', Miaria, et al,
> > 1983] found...[t]he lowest comprehension scores were achieved on programs
> > that were not indented at all. The second lowest were achieved on programs
> > that used six-space indentation. The study concluded that two to four space
> > indentation was optimal. Interestingly, many subjects in the experiment felt
> > that the six-space indentation was easier to use than the smaller
> > indentations, even though their scores were lower."
> > The original study was printed in the Nov 1983 Communications of the ACM.
> Tell Linus!
Rather, tell everyone who falls for those bogus "appeals to authority"
arguments. Appeals to empirical studies, now that is something I'd fall for
Here is the complete abstract, from the following web site (lots of
interesting stuff there!):
"Miara, J. R., J. A. Musselman, J. A. Navarro, and B. Shneiderman. Program
Indentation and Comprehensibility. Comm. ACM 26, 11 (Nov. 1983), 861-867.
Abstract: The consensus in the programming community is that indentation
aids program comprehension, although many studies do not back this up. We
tested program comprehension on a Pascal program. Two styles of indentation
were used-blocked and nonblocked- in addition to four possible levels of
indentation (0, 2, 4, 6 spaces). Both experienced and novice subjects were
used. Although blocking style made no difference, the level of indentation
had a significant effect on program comprehension. (2-4 spaces had the
highest mean score for program comprehension.) We recommend that a moderate
level of indentation be used to increase program comprehension and user
This paper addresses the impact of indentation and blocking on program
comprehension. By blocked indentation, the authors mean that statements
immediately within a begin ... end pair share a common left margin with
those delimiting keywords. In nonblocked style, the delimited statements are
indented further. The authors review previous studies of indentation, noting
that their support for the hypothesis that program indentation aids program
readability and comprehension is, at best, ambiguous. They explain possible
reasons for the discrepancy between their results and those reported by
others. The results of the experiments reported here favor the view that
indentation aids comprehension, but they also show that excessive
indentation (6 or more spaces) does not increase the effect. Interestingly
enough, the novices in the study reacted very favorably to indented code and
rejected the nonindented program. Experts, on the other hand, showed no such
prejudice. This is a good paper on the effect of formatting practices. The
experiment was done carefully, which makes it especially relevant to those
interested in empirical studies. The practical wisdom to take away from the
paper is simple:
indent code three spaces to show its structure. This paper is recommended
for both instructors and students."
More information about the Python-list