From Inkscape Wiki
Revision as of 17:10, 21 December 2003 by JonCruz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Found at

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 satisfaction.

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.