Live data from Hacker News

But no, 80-column terminals in 2020 isn't “reasonable” any more

lkml.org

121–130 of 330 posts

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#121

Optimal code line width has very little to do with monitor or window width. It's more of an anatomical restriction: the resolution of the human eye and the field of view. For example, if we had 10 meter-wide monitors we won't be able to see them entirely from a close distance. Increasing the distance will require to increase the font, so the number of characters per line we can use doesn't change much. Not so long ag…

> It's more of an anatomical restriction: the resolution of the human eye and the field of view.

The restriction on code length to 80 has absolutely nothing to do with the resolution of the human eye or your field of view.

> For example, if we had 10 meter-wide monitors we won't be able to see them entirely from a close distance. Increasing the distance will require to increase the font, so the number of characters per line we can use doesn't change much.

Again, this isn't relevant to the question of say, 80 cols vs 100 cols vs 120 cols. No one seems to be saying cols should be unbounded in length.

> Not so long ago I showed a piece of code on a mobile phone screen to a colleague, saying he should use shorter lines. He replied I need a larger display. When I opened the same code on my desktop display the lines were not fitting the editor window almost the same as on the mobile screen. (We keep phone closer to eyes so can use smaller characters).

I'm not sure how this is an argument for 80 cols other than the already addressed "I limit my development environment to 80 cols".

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#122
post #68
post #49

The problem with overly wide lines is that it hurts readability because it's harder to find the next line when scanning your eyes from right back to left. Take it from the world of books: This study may be helpful: > This study examined the effects of line length on reading performance. Reading rates were found to be fastest at 95 cpl. Readers reported either liking or disliking the extreme line lengths (35 cpl, 95 c…

Let's say I want to find every function call too `foo` that passes `true` as the last argument. I might do something like `grep "foo\(.*true\);"` That would work well enough if the codebase was mostly uniform and all calls to foo were on a single line. However, if we have callsites like "foo(x->y(get_arg(z)), something, \ntrue);" where 'true' is split onto a newline, that naive grep misses it. As linus says, grep is…

I have a fairly simple solution for the scenario you’ve presented. grep, and return some context (maybe +5) and then grep on that again with the argument you’re looking for (give a negative context this time so you get the entire function call)

That being said, as unlikely that scenario is, having it all in 1 line does not work either. The problem is that its very likely/possible that the true argument will be passed in in the form of a variable. So you’re back to needing something that is more code aware anyways.

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#123

The problem here is that our editors aren't smart enough to wrap code appropriately. Word processors know to wrap lines on word boundaries; a smart code editor should be able to wrap lines and indent parameters in a human-pleasing way as you drag a window wide or narrow.

I think most editors these days do a pretty decent job? It's not perfect, of course, but 99% of the time it's fairly readable.

It's readable, but not so good that people use it and stop fighting over line length and indentation rules.

Four years ago I wrote a stackoverflow question about this and included some pictures:

https://stackoverflow.com/questions/31414385/is-it-possible-...

I got a link to a dusty now-9-year-old issue in Jetbrains' tracker:

https://youtrack.jetbrains.com/issue/IDEABKL-6076

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#124
I think this is a subject most editors fail to address.

A single line of code should be written to file as a single line - no matter how long. However, the editor you are using should be able to gracefully word wrap it depending on your settings.

Most editors word wrap based on window size or some other hard setting. They should be able to wrap gracefully at a logical point in the code e.g. at a comparison operator or a dot in a function chain. Wrapped lines could be tabbed or visually flagged to let you know.

In other words there should not be am ideal line length for code, but instead editors should be able to adapt to make life easier for developers.

Look at word processor documents, imagine how much of a nightmare it would be if such documents had a hard limit of characters per line.

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#125
The critical viewing scenario is two files displayed side by side. This is very useful, but having to side scroll makes it less useful. So when choosing an optimal maximum line width per file, pick an optimal display width and cut that in half.

And if I'm a coder on your team, please pick the optimal display width using a 12 inch 1080p laptop screen. Also, pretend that your vision isn't 20/20. Thank you.

Bottom line, 80 columns isn't unreasonable.

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#126
post #49

The problem with overly wide lines is that it hurts readability because it's harder to find the next line when scanning your eyes from right back to left. Take it from the world of books: This study may be helpful: > This study examined the effects of line length on reading performance. Reading rates were found to be fastest at 95 cpl. Readers reported either liking or disliking the extreme line lengths (35 cpl, 95 c…

> The problem with overly wide lines is that it hurts readability because it's harder to find the next line when scanning your eyes from right back to left.

There is some truth to this, but it's largely irrelevant. When text is laid out for books, it's based on a fixed width and each sentence follows the next. Code isn't laid out that way, with code, each statement starts on a new line which naturally limits line width.

Good programmers gravitate towards shorter lines of code by nature. If your average line of code is wider than 80 characters, it's likely you have some other, bigger coding style problems which need to be addressed.

But having the option to use longer lines when it makes the code more readable is also valuable. Putting a fairly short, arbitrary limits on line length just makes other parts of coding less pleasant, variable names in particular suffer quickly when you can't make comparisons on a single line.

Where I work, we wrap lines at 120 characters but the overwhelming majority of the code is less than 80 characters wide. Longer lines are reserved for if statements with multiple conditions or ternary assignments.

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#127
post #104

Earlier quoted context omitted.

Ironic that his reply is almost unreadable on mobile because of his hard wrapping. Intentional?

Github provides an email to Github comment gateway. So he was composing his replies in his email client.

And his email client hard-wraps at 80 chars, because that's the standard of both Linux and Git mailing lists, because they send patches in emails. I like the irony :)

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#128
post #36

Typical ill-considered comment from Linus, and surprising for someone getting on his years. Column width is an accessibility issue . I'm barely in my mid 30s and the average font size has been steadily creeping, maybe 1.5 pts per 5 years. I could tolerate 132 column files today, but by the time I'm 50 there is no way this will work, regardless of screen size

Do you need reading glasses? I found I did (I'm 47) and it made a massive difference in looking at code- I can use a smaller font and experience much less eye strain.

I've also been buying a larger monitor every few years, as the prices drop.

But I hated the 42" 4K I tried and returned it. The problem was the edges are just too far away. If I use them I end up with the same kind of neck strain I would get with a multi-monitor setup. So I only used kind of the middle section of the screen anyway. And at 42" 4K the physical pixels are just too big - everything is fuzzy.

32" 4K is the sweet spot for me. Maybe when there's a reasonably priced 42" 8K curved display I'll give it a go.

Re: But no, 80-column terminals in 2020 isn't “reasonable” any more

#130
post #83

Earlier quoted context omitted.

How do you mean 8 space tabs? Are tabs not single characters \t?

You can customize your text editor to show them as any number of spaces. Mostly people prefer tab-stops at each forth or eighth column.

In practice you get problems, because of the line length rule.

I.e. if your editor is configured with four-space tabs and a line with one leading tab shows up in your editor having 79 characters, it will show up as 83 characters for others assuming the normal 8-space tabs thus breaking the line length rule.

Not to mention that coding style may require that function calls broken to 2 lines must have the arguments aligned at the opening parenthesis.

For example, breaking up foobarbaz(1, 2); into two lines would require having the second line start with 2); which would no longer look correct with 4-space tabs.

Post reply on HN