Does Column Width of 80 Make Sense in 2018?
hackernoon.com
hackernoon.com
80 wasn't chosen, or kept so long, arbitrarily. To overcome the issues with both readability and ability to support side-by-side diffs or multiple files on smaller monitors or for those with poorer eyesight, there'd have to be a supportable positive reason to go higher. So far all I've seen is personal preference and occasionally support of bad habits (e.g. "trying to do too much in a single line" as another commenter put it). I just don't find that very convincing.
The argument in favor of narrow-width columns still stands. But we do indeed need to acknowledge that most people read on digital devices now.
But maybe I'm getting old. :)
This "something" includes:
- Deeply indented (= nested) code
- Very large numbers of function arguments
- Overly-verbose naming
- The Train Wreck anti pattern
In my experience, 80 is indeed a bit limiting, especially in languages where you're basically forced to start 3 or 4 indentation levels deep, but anything beyond 120ish is usually a sign that you're doing something wrong.
Readability. It's difficult enough to read through long lines of normal text on a badly formatted website.
Naming. I could go on about this one. Namespacing was created for a reason, don't write any long names. This most often will make your code considerably shorter.
Formatting. If you have short names and you're still ending up will the long lines, you need to understand how to format your code properly.
I have the luxury of writing code only for myself, so I can maximise devotion to my 'personal style' and not worry about other people's opinions.
I'm all about information density, and since on 99.9% of monitors the vertical axis is the short one, and the horizontal axis is the long one, I want to save as much vertical space as possible. This is also why I can't stand horizontal tabs (thank you, Tree Style Tab).
On a 27" 4K monitor I get two side-by-side files open in my IDE, with a 10-point font, at 160 char wrap, with vertical tabs. This fits my style because I favour inline comments which maximises my use of the vertical space by not needing another line.
Luckily my eyes are still good enough to read this!
On the other hand with 120 limit every once in a while you have to read very long line, and with merge tools or big fonts you can have problems and have to scroll.
IMHO it's not worth it. 80 is ok.
You burn some vertical room -- all the more apparent with today's widescreen trend. But when you're trying to keep the strain from driving you crazy when reading a bunch of adjacent wide lines, it can help.
Also, other visual differentiators. Remember the old, wide band-printer reports, done on paper that varied background color every 5 lines or similar?
I think there is a solid argument for not consuming the entire column count of a screen,not sure if that's 80 though.
This especially matters when you start doing dumb things to codebases like 1-space indents, abbreviated variable names, etc. for the sole purpose of making a linter shut up.
Too-small indents are bad for many of the same reasons as too-long lines, only even more so. The main argument in favor seems to be the desire to cram as much as possible into each line, which is a code smell of the first order. The main argument against (which I find much more compelling) is that it becomes really hard to match up the indentation levels to see the true structure of code without artificial aids. Besides being ugly, those faint vertical lines won't be there in every situation, such as when you're looking at code in a review tool or in gdb or a "primitive" editor while you scramble to fix a problem on a production machine that doesn't (and shouldn't) have your favorite heavyweight IDE installed. Ergonomics matters, and it's about more than personal preference.
In Lisp you can have code blocks that are clearly independent units hanging 50 characters off to the right. A limit of 80 would limit the lines in the code block to 30 characters, which is not enough. Lisp tends to have pretty long function names, like multiple-value-bind or with-open-file.
I think 120 might even be pushing the limits of conscientiousness.
There's definitely a bit more flexibility - not infinite - when you only consider the full-scale case. But one is often less productive with that as the only viable option, or else one has external monitors in which case in that usage pattern the laptop is effectively a desktop.
The real fallacy is in denigrating the side-by-side workflow. Just having every window be fullscreen would be madness.
Anyway, one doesn't have to go to that extent to make the point: as per the sibling reply from d_, even on a 17 inch monitor one can have issues with 120-character lines if viewing two files side by side (or 50% browser 50% editor).