4 ms·
It isn't just a historical accident. There's a good reason why they were about eighty columns. It's because the eye can't comfortably scan much further. Th
by DonaldFisk 11y ago
It isn't just a historical accident. There's a good reason why they were about eighty columns. It's because the eye can't comfortably scan much further.
That's why pilots are recommended to scan horizontally no more than about 10 degrees at a time when looking out for other aircraft:
http://www.skybrary.aero/index.php/Visual_Scanning_Technique http://www.skybrary.aero/index.php/Visual_Scanning_Technique
- adrusi 11y agoThat's... true, but lines of code don't actually reach nearly 80 characters in length when you limit lines to 80 characters. Once you subtract the indentation, the remaining width of the line between the termination and the 80 character mark, and the fact that many/most lines won't be hitting the line limit in the first place, you'll find that a limit of 80 characters makes the average line length roughly 50 or 60 characters of actual code. Having lines be too short is also a concern for legibility, because even when lines are short, there's always the risk of the reader missing the next line at every line break. The 80 character line is actually an artifact of punch cards, which supported 80 characters per card. And that's probably a remnant of some automatic loom that for some design reason, worked best with instructions fed in chunks of 80s.
- DonaldFisk 11y agoYou should have the whole context comfortably within view, which means all the characters in the lines above and below should be in the same 10 degree visual block, i.e. about 80 characters. The exact value of 80 characters might be because of IBM punched cards, but that value was chosen because printed media already had that limit, or a smaller limit, e.g. broadsheet newspaper columns. People have been writing that way for millennia. Two other points: (1) 70 or 90 might have been acceptable alternatives, but 80 was chosen. It's approximate. Fewer limits the amount of information per line, and more limits the font size you need to scan comfortably. A wider screen allow you to open up several windows. Having one big window isn't such a good idea. (2) I have never been bothered by this limit, except when others break it and I have to read their code. Occasionally, sticking to it requires some thought regarding program layout. If you find yourself exceeding 80 columns often, you're probably doing something wrong. You might be nesting your code too deeply when you could call a function which handles some of your conditional logic, or your function names are too long, which suggests the underlying functions are doing too much and should be split up.
- bsder 11y ago> There's a good reason why they were about eighty columns. It's because the eye can't comfortably scan much further. Except that you are wrong. One of the links in the comments here has research that shows that reading speed increases significantly to at least 90 characters and may increase further than that.
- DonaldFisk 11y agoThis? http://psychology.wichita.edu/surl/usabilitynews/72/LineLength.asp http://psychology.wichita.edu/surl/usabilitynews/72/LineLeng... I had to move my head with every line I read. (The PDF is somewhat easier on the eyes.) Not a single reference to aviation, the context where most of the related research has been done, and where research matters most, as people's lives depend upon it. The article was specifically about reading news on-line, and was a very small study. Reading code is somewhat different to reading prose in natural language such as news. To understand a portion of code at all, you need to take in every token. With very long lines, this means having to move your eyes back and forward. Laying it out vertically makes scanning a lot easier.