Live data from Hacker News

80 Characters per Line Is a Standard Worth Sticking to Even Today

nickjanetakis.com

11–20 of 48 posts

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#12
One reason to suggest a smaller max character count is to assist those with impaired vision. I'm highly myopic and, while my lenses correct for it, I still seem to get eyestrain when using the default font/sizes in most IDEs. Bigger-screen monitors counterintuitively seem to make this worse, not better.

I can only imagine that this would be even more important for individuals with more severe vision impairments.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#13
The whole analysis of justifying 80 characters per line by talking about how many more windows you can place side by is problematic. The problem is that this same logic would suggest that 40 characters per line is even better because we can get in even more side by side views.

I would like to talk about the downsides of 80 characters.

First point is that most monitor configurations are wider than they are tall. When you have 80 characters for line, you are wasting a lot of horizontal space on most configurations. This is especially true with laptops.

Second, at least for me, I am focusing on 1 file most of the time. 90% of the time, I write code in 1 file, with maybe 10%, I look at 2 files. With wide lines, I can see more of my code at a glance without scrolling.

Third, when you break at 80 characters, you waste more space cause you need to indent the new lines that were broken up.

Fourth, if you use languages like Python that have semantic whitespace, you need line continuation characters that just add to the noise.

Fifth, for those cases where you are comparing code side by side, having an editor that does intelligent wrapping to make code narrower is not that big of a deal.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#14
post #8

Vscode does an autowrap maintaining the indent. So you can have it at any number. I don’t get the 80 char width fanatics. I like long lines. I want my editor to format it based on my screen width. 80 breaks my flow.

That's great if you are working alone or on a team where everyone agrees on the same editor with the same auto-wrap feature. In a mixed environment, writing code that is only readable if people choose the same tools you prefer can be a bit rude.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#15
post #3

This isn't too hard in some languages and I prefer it, but there are other languages (like C#) where class names are long and descriptive (e.g. ImmutableSortedDictionary) and it becomes harder to read instead of easier.

C# offers a way to mitigate that, somewhat. I often have something like this among the top level `using` statements. using FooMemo = System.Collections.Immutable.ImmutableSortedDictionary ;

Also `var` is such an important mitigatory for this in C# that it continues to astound me that some of the worst offenders also eschew `var` in C#. You really don't need the redundancy of `ImmutableSortedDictionary localCache = new ImmutableSortedDictionary()`, it's not some sort of Prolog assertion where the strict tautology makes different code than `var localCache = new ImmutableSortedDictionary()`.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#16
One VS Code suggestion I'd mention is Centered Layout mode (under View > Appearance). If you only have one editor group open and aren't doing side-by-side work, it's a nice relaxed view of the editor that defaults to roughly 80 characters as well. (Official docs say it defaults to a golden ratio of your screen resolution, so it's not directly based on character count.)

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#17

The whole analysis of justifying 80 characters per line by talking about how many more windows you can place side by is problematic. The problem is that this same logic would suggest that 40 characters per line is even better because we can get in even more side by side views. I would like to talk about the downsides of 80 characters. First point is that most monitor configurations are wider than they are tall. When…

Completely agreed. I prefer 100-character lines; with that, I have less line-breaking, and I can still easily fit two code windows side-by-side on my widescreen monitors. 120 characters would be good too, but I think anything over that yields greatly diminishing returns.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#18
post #8

Vscode does an autowrap maintaining the indent. So you can have it at any number. I don’t get the 80 char width fanatics. I like long lines. I want my editor to format it based on my screen width. 80 breaks my flow.

That's great if you are working alone or on a team where everyone agrees on the same editor with the same auto-wrap feature. In a mixed environment, writing code that is only readable if people choose the same tools you prefer can be a bit rude.

That cuts both ways. The most comfortable combo of a display and font size leaves me at 70 characters per line, making anything more wrap awkwardly. It wouldn't be a stretch to say that XX-chars limit only works if everyone else has tools that work best with XX.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#19
post #9

In code, enforcing a max character count per line is debatable and has some merit. In prose (i.e. documentation written in Markdown), I'd say that enforcing a max count is definitely counterproductive. Prose is meant to start a new line whenever it's needed. What you write in Markdown is not necessarily how it'll get formatted on a web page (i.e. even if your input is capped at 80 characters per line, the output migh…

Can you explain how any of the above connects to anything else? If the markdown text will be reformatted for display, you get no benefit from writing it in a wider format than allows more than one source document to be on the display at once. You seem to be saying that when writing markdown you have no need to refer to anything else?

> you get no benefit from writing it in a wider format

Putting unlimited characters on a line is not merely a "wider format". It's a way of saying "format it as wide as you like", therefore the benefit is not in having a wider format, but one that simultaneously wider and narrower, depending on what's needed.

  To help visualize the benefit, abolishing line length in
  prose prevents
  lines from breaking in unexpected places, when the user's
  display is
  narrower than the preformatted text line. I find it
  extremely jarring.
With almost every editor today being able to word wrap, this stops being a problem.

While line lengths may be significant for code, where limiting "sentence length" may be useful, prose is an entirely different thing to read.

Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today

#20

One VS Code suggestion I'd mention is Centered Layout mode (under View > Appearance). If you only have one editor group open and aren't doing side-by-side work, it's a nice relaxed view of the editor that defaults to roughly 80 characters as well. (Official docs say it defaults to a golden ratio of your screen resolution, so it's not directly based on character count.)

I prefer Zen Mode, which is similar but with only the file you're editing showing.
Post reply on HN