On Tuesday 16 August 2005 6:27 am, Gavin Kistner wrote:
[talking about 80 character lines...]
I think it's a nice initial goal, but I personally don't fret if half
my lines are 100 characters long, and the occasional line tops 130 or
more.
I generally try to keep my lines less than or close to 80 lines, as well, but
it's not over any great concern about whether or not the lines will fit on
someone else's screen. Just as processor speeds climb and storage media
capacities soar, screen resolutions have also increased, and with them, the
usable line length has changed, too. I used to believe that the 40 character
wide Apple ][+ lines were perfectly reasonable, for example. Technology is
no great limit, unless one is coding on or reading code on a palm-sized
computer.
My reasoning for generally trying to stay at 80 characters are that by
sticking to some arbitrary limit, it helps me to think about how the code and
the comments do look. Comments that stick to an arbitrary limit are nicer
looking and easier to read, and often if I have a line of code that is
growing well beyond that arbitrary 80ish character limit, it's a signal to me
that there might be a simpler approach or that I am probably writing a
Faulkner style sentence when a Hemmingway style paragraph would probably be
easier to read. Like that sentence you just finished reading. Sure, it's
fine, but turning it into multiple sentences would be better for most
readers.
It is just a general rule, though, and I violate it all the time. For
instance, if I am creating a chain of several method calls or doing something
similar, it may be easier to understand a single long sentence instead of a
paragraph of short sentences.
As with so many style issues, it comes down to personal taste. Do what makes
sense for you and your audience.
Kirk Haines