Tuesday, 29 April 2014

bens_dad: (Default)
I've been developing some code for a new (to me) open source project (GDAL).
One of the requirements of the developer guidelines is
Try to keep lines to 79 characters or less.

12345678901234567890123456789012345678901234567890123456789012345678901234567890

That is an old idea; 80 column teletypes (glass and paper) go back a long way
(though my first experiences of computing, forty years ago, were 132-column
printouts and IIRC 13-column punched cards, perhaps show the demand for wider
lines even then) and Knuth is said to have recommended 72 column text,
as that was about as much as an eye could see at once.

Programmers like to have as much code visible as possible; I've heard monitors
with a large (c1200) vertical resolution described as "programmers' monitors",
and such monitors were highly prized in the software house I once worked.

My attempts at learning Python were blocked for several years because although
I knew that indentation and line breaks were part of the syntax, I hadn't heard
of the rules that allowed a code statement to continue onto the next line.
Thus I was unable to write anything that required a statement wider than a
comfortable editor window. With meaningful variable and function names that
became a significant limit on an 80 column screen.

I had been developing much of my the GDAL code on a wide-screen laptop with more
than enough room for two 80 column windows side by side but not a lot of height,
so when I discovered this rule I went back and found that my code had got much
wider. The sample code I was working from was also heavily commented;
so much so that on an 80x24 window (the default terminal size on many systems)
a single idea could not always be coded on a single page. By making my screen
wider I had got my ideas to fit the page, but the 79 character rule meant
rewriting much of it and it became to long for comfort on the wide-screen laptop
with its restricted vertical resolution (once I would have fixed that by making
the characters smaller, but my eyesight is no longer sharp enough for that).

This post has a hard line break at least every 80 characters.

Profile

bens_dad: (Default)
bens_dad

July 2025

S M T W T F S
  123 45
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Friday, 4 July 2025 10:50 pm
Powered by Dreamwidth Studios