Boost logo

Boost :

Subject: Re: [boost] coding conventions
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2010-01-06 15:46:46


Jeff Flinn wrote:
> Stewart, Robert wrote:
>> Beman Dawes wrote:
>>> Filesystem.V3 uses 90 characters as the normal width, and I'm
>>> planning to gradually move all of my code to 90.
>>
>> That's hardly in keeping with the advice in
>> http://www.boost.org/development/requirements.html#Design_and_Programming.
>> It may not be a hard rule, but wouldn't it be better to get consensus
>> on changing the guideline before doing so?
>>
>> Incidentally, why 90 columns? Is that just to annoy those that rely
>> on 80 columns for readability? ;-) Seriously, it seems such an
>> arbitrary number that I'm left to wonder why.
>
> Of course we should stick with the FORTRAN driven 80 character limit
> for and eschew any advancements in computer technology for eternity. ;-)
>
> I can come up with arguments for longer character limits based on good
> graphic design and presentation practices. Why not 90?
Usability practices, which I would be surprised to find contradict good
graphic design and presentation practices, suggest that for best and
fastest comprehension information should be in one field of view without
having to turn your head, the same as in books. Pull some books off
your shelf and count columns, they'll all be close to sixty. Of course
in art you can take advantage of having the user's attention move
through a path, but code is a very different problem domain than art!
With art you often WANT to make the viewer work. If you want others to
be able to easily understand your code, it should, like books, not be
longer than about 60 meaningful columns. If you restrict yourself to 80
columns that leaves you up to five 4-column indents before making the
code hard for people to understand. With 3-column you'd have about six
levels of indentation, and with 2-column indents you'd have ten levels
of indentation (too many!). If you go with 90, but restrict the
non-leading and trailing whitespace to 60, i.e. have BIG indents, you'd
have the same usability if the viewing environment supported it, but a
lot of people will hate you because they'll have to make windows wider
just to look at your stuff. Of course there are other issues of too
long a logical block of code and too many depths of indentation (logic)
that also impact comprehension, usability, maintainability, etc...

The usability research on this was done years ago, and is available via
google searches from a lot of places. It's just how the human brain
works, things in the center of our field of view are treated specially.

Cheers,

Patrick


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk