Hacker News new | ask | show | jobs
by NateDad 4499 days ago
The argument about no one editing in a 80 character terminal anymore is a straw man. That's not the real reason 80 characters is good. The article even says why - we're just not good at reading long lines for whatever reason.

There's two modern reasons for smaller liner lengths (80-100) besides cognitive capacity:

Viewing/editing two files side by side on the same screen.

Side by side diffs.

Now, that's not to say that you should contort the code to make lines short. If it makes the code significantly more difficult to read, don't do it... but still try to keep it reasonable. This is also a good reason to keep your variable names relatively short - so you don't hit this situation all the time.

2 comments

What doesn't help is silly idioms in some environments where most of the lines written START at 2 or 3 indents deep because they're inside a method inside a class inside a namespace that are all indented.

===

If anyone's interested, I wrote a simple command to scan files for configurable line length violations and the presence of a file-terminating line ending.

https://github.com/frou/pagecop

(yes, I'm aware it could probably be duplicated with some sed/awk wrangling!)

The main argument for me, additionally to what you describe, is keeping lines readable. There is a reason the books from 1000 years ago were made vertical. They could have used much more width and characters per line but they didn't. See the newspaper format as well with multiple columns. The eye struggle to follow a text that is too wide.

For me, 80 chars is an arbitrary but acceptable limit (I could even argue it should be even shorter).

Personally, I view verbose languages that needs longer line as bugs. If you look at Scheme for example, it lets you wonderfully indent and nest, so that you rarely need long lines. Everyone benefits from it. Shorter lines are better for the brain, the problem is when coding languages make line too long by design, forgetting the 1000 years of experience in typography we've accumulated.