Jump to content


Photo
- - - - -

Logic Indentation


2 replies to this topic

Poll: How many spaces do you use in logic for indentation? (37 member(s) have cast votes)

How many spaces do you use in logic for indentation?

  1. One (1 votes [2.70%])

    Percentage of vote: 2.70%

  2. Two (6 votes [16.22%])

    Percentage of vote: 16.22%

  3. Three (25 votes [67.57%])

    Percentage of vote: 67.57%

  4. Four (5 votes [13.51%])

    Percentage of vote: 13.51%

  5. Five plus (0 votes [0.00%])

    Percentage of vote: 0.00%

  6. What's indentation? (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote

#1 Cleve Haynes

Cleve Haynes

    Expert

  • Members
  • PipPipPipPip
  • 172 posts
  • Gender:Male

Posted 16 October 2007 - 02:48 PM

A hugely important question: how many spaces do you use in logic for indentation? :x:

#2 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 17 October 2007 - 08:12 AM

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

:x:
Nothing's as simple as you think

#3 aineix

aineix

    Newbie

  • Members
  • Pip
  • 4 posts
  • Gender:Female
  • Location:Philippines

Posted 17 October 2007 - 02:43 PM

since spaces also eats a lot, i think 3 spaces is enough to view your codes in an organized manner.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users