On 80 columns should (not) be enough for everyone

Sean Kelly sean at invisibleduck.org
Sun Jan 30 20:47:56 PST 2011


Andrei Alexandrescu Wrote:

> On 01/30/2011 01:20 PM, Sean Kelly wrote:
> > Walter Bright Wrote:
> >
> >> Andrej Mitrovic wrote:
> >>> 80 columns
> >>> wasn't determined by some scientific method to be a good size for code, it's
> >>> a product of limitations of the older generation hardware.
> >>
> >> 80 columns came from how many characters would fit on a standard size 8.5*11
> >> sheet of paper. Even punch cards followed this precedent.
> >>
> >> That paper size has stood the test of time as being a comfortable size for
> >> reading. Reading longer lines is fatiguing, as when one's eyes "carriage return"
> >> they tend to go awry.
> >>
> >> You can see this yourself if you resize and reflow a text web site to be
> >> significantly wider than 80 columns. It gets harder to read.
> >
> > Print text doesn't have indentation levels though.
> 
> It does - bulleted and numbered lists, certain sidebars, block quotes.

True.  Though multiply nested such blocks are rare.
 
> > Assuming a 4 character indent, the smallest indentation level for
> > code in a D member function is 8 characters.  Add a nested
> > conditional and code is starting 16 characters in, which when wrapped
> > at 80 characters begins to look like a newspaper column.
> 
> Newspaper columns are strongly optimized for being read quickly. Not a 
> bad standard I guess.
> 
> I don't contend that your choice works for you, but I refute this 
> particular rationalisation of it. Indentation should NOT be discounted 
> as a participant to the maximum line width. If anything it adds 
> overhead, not reduces it.

I just said that indentation reduces available space for code.  How is that discounting it?  That aside, I don't know that the comparison to newspaper columns really holds.  Sentences wrap naturally, while I'm not sure the same holds for a code statement--consider languages that require one statement per line.  At the very least, wrapping a statement often requires additional consideration to line up related sections to ease readability.  That isn't to say that I think a programmer should pack as much as possible into a line of code.  Quite the contrary, in fact.  I'm simply relating my experience with having a hard 80 column break, which is something I used to do religiously.


More information about the Digitalmars-d mailing list