Live data from Hacker News

Is the 80 character line limit still relevant? (2008)

richarddingwall.name

51–60 of 180 posts

Re: Is the 80 character line limit still relevant? (2008)

#51
post #47

Earlier quoted context omitted.

I have to push back here a little bit. It really depends. I mainly use Scala, and I think the majority of Scala code would be far less readable if forced to 80 columns, than if it were a larger number (or simply unconstrained). My WFH monitor is an Apple Thunderbolt Display, which is woefully out-of-date now. Even on this display, and even though I use a much larger font than most people (16pt Hasklig), and even with…

With 180 characters on your display and lines of more than 90 characters, you can't put two code windows side-by-side. But it sure depends on the language too, though I wonder what's so peculiar about Scala to really benefit from long lines?

Method chaining, and a lot of it too. I honestly think it's a code smell, but some people love to do a dozen transformations in one line. You then need to make the line twice as long with .taps to debug it.

Re: Is the 80 character line limit still relevant? (2008)

#52

> formatting tennis That's a paddling. Seriously, professionals do this? If someone else wrote it and it does what it is supposed to do, it is not, NOT (no apologies for shouty emphasis), my job to change that. (I hate tabs, but will never :retab someone else's code.) My job is either/both to fix bugs and add new capabilities, not to be precious about, well, anything. I would have serious reservations about any team…

Very few professionals do this. Most people writing code are not professionals.

Re: Is the 80 character line limit still relevant? (2008)

#53
I like 80 columns because I like to use multiple applications at once.

80 columns is about the sweet spot to have an editor on one vertical half of my laptop screen with the font set to a comfortable (read: large-ish) size, with something else (e.g. a browser) on the other side.

Re: Is the 80 character line limit still relevant? (2008)

#55
Considering how easily I lose track of my position when reading long lines and how easy it is to read vertically when lines each have a single word on them, I seriously question the method by which most developers determine that they prefer >80 character line length limits.

Re: Is the 80 character line limit still relevant? (2008)

#56

80 characters is way, way too short. I think 120 is a decent spot for today's displays, although I don't mind even longer than that either.

IMO 120 is the extreme limit but a good limit. Anything higher than 120 is to long and, personally, I'd ask for that to be fixed in a code review.

Re: Is the 80 character line limit still relevant? (2008)

#58
post #57

An 80 character limit is difficult to stay within when using highly descriptive variable names, and I think the benefits of highly descriptive variable names outweigh other considerations.

It's not impossible if you're using an indent of two spaces and not doing a lot of nesting.

I think 100 characters would be a better limit, though.

Re: Is the 80 character line limit still relevant? (2008)

#59

Considering how easily I lose track of my position when reading long lines and how easy it is to read vertically when lines each have a single word on them, I seriously question the method by which most developers determine that they prefer >80 character line length limits.

How descriptive are your variable names and how how many of them are you passing around? Comparing x to y in a few different ways will easily fit into 80 columns, but you can only put something like machinePoolControllerGroup or webhookControllerRuntime a couple of times before hitting 80 chars with indentation.

Re: Is the 80 character line limit still relevant? (2008)

#60
Note that when we talk about line length limits, we're actually conflating two separate concepts:

1) The maximum width of our viewports

2) How long we want our lines to be

WRT the second concept, the general rule of typography is that a line should be 60-80 characters long. But, crucially, this is not counting indentation; a "line" here begins at the start of the text, not at the start of the margin.

In the modern day we could decouple these two concepts. Imagine a standard code format that assumed a maximum viewport of, say, 120 characters, but still wrapped lines when they reached 80 characters in length, not counting indentation. Then you could get the benefits of both enforcing a maximum viewport size while having a comfortable line length for reading.

Post reply on HN