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.
80 Characters per Line Is a Standard Worth Sticking to Even Today
21–30 of 48 posts
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#22There’s empirical evidence to back it up.
The “I have a big monitor” guys just need to stop. Please.
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#23In 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…
Editing plain text using my favorite font, Bistream Vera Sans Mono 12, on a 1920x1080 display, lines break about the 150th column. That width seems to work reasonably well for me when writing blog posts.
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#24Textbooks and newspapers print in multiple columns, even when using tabloid size paper, because it’s more readable. There’s empirical evidence to back it up. The “I have a big monitor” guys just need to stop. Please.
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#25(This is why gofmt doesn't enforce a line limit.)
When a human edits the code, they can fix it if the lines seem too long.
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#26Earlier quoted context omitted.
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 ()`.
var localcache = cachemaster.cacheFor(foo);
Now you have no idea what it is until you dig into the (hopefully correct) API docs, or use an IDE that can untangle things.
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#27The 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…
But then you're requiring those who read through your code to have the window displaying your code maximized in order to avoid having it wrap or having to scroll to read it.
> 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.
When viewing diffs, a lot of people like to view them side by side. In some cases, people use a tool like kdiff3 to handle merges and need to be able to see 3 copies of the file side by side.
> Third, when you break at 80 characters, you waste more space cause you need to indent the new lines that were broken up.
It really depends on whether you use a lot of long variable names and/or have to include scope identifiers when referencing them. In python, a typical module may have a very small fraction of statements that require lines greater than 80 characters. That means that it doesn't add that many more lines to the file compared to just keeping those longer statements as a single line.
> Fourth, if you use languages like Python that have semantic whitespace, you need line continuation characters that just add to the noise.
Not necessarily. Any opening (, [, { can effectively serve as a continuation character. So you could write a print statement like:
print(
'Hello there. '
'This will be printed on a single line.'
)
> 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.For line based diffs, it does make the diff significantly harder to read in my experience (especially when looking at the source file in conjunction with the diff).
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#28Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#29This 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 ;
Re: 80 Characters per Line Is a Standard Worth Sticking to Even Today
#30The 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.