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.
No it's not, it's perfect. You want to be able to do side-by-side diffs on your laptop using a normal sized (not tiny) font. You want to be able to paste snippets into design documents and emails and blogs without accidental wrapping or truncating or scrolling. 80 is nicely legible. It works really well.
Is the 80 character line limit still relevant? (2008)
101–110 of 180 posts
Re: Is the 80 character line limit still relevant? (2008)
#102Earlier quoted context omitted.
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.
I just bought an ultrawide, and I just checked to see how wide my lines are in my code editor. 350 characters. When I'm coding for myself, I use all of that at times. I love that there are some things I no longer have to break onto multiple lines any longer. Also, if you have a ton of nested loops etc, then you don't end up with that problem where you can only see the first few characters of the deepest lines.
Re: Is the 80 character line limit still relevant? (2008)
#103Re: Is the 80 character line limit still relevant? (2008)
#104Re: Is the 80 character line limit still relevant? (2008)
#105I have one rule: code flows vertically. I like reading books. Code should read as easily as a book. I have found that if you constrain your code to being shaped like a book, almost everything else follows naturally.
You can’t be indented 7 levels into hell if your code has a reasonable line limit. You can’t jam arbitrary numbers of statements onto a single line. You have to decompose your control flow at reasonable function breaks. Lines are a better primitive for editing and debugging. Etc. etc. etc.
Re: Is the 80 character line limit still relevant? (2008)
#10665-80 for readability however once you introduce indentation this naturally increases. I always felt that shorter lines were a good way to encourage less nested code. Alas after all these years the consensus is against me.
Re: Is the 80 character line limit still relevant? (2008)
#107Re: Is the 80 character line limit still relevant? (2008)
#108Sticking with 80 characters has been great for my team. Not only does it encourage shorter lines, but comparing diffs on GitHub ensures that both old and new comparisons fit evenly on the page without any cutoffs or wrapping
I view diffs side-by-side all the time with much wider lines than 80 chars, but I have 27" monitors, which are not unusual these days.
Re: Is the 80 character line limit still relevant? (2008)
#109Re: Is the 80 character line limit still relevant? (2008)
#110Earlier quoted context omitted.
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.
120 is way too small. IMO 180 is a good limit. We're not on 800x600 screens anymore
Some languages are just naturally worse at this (eg. Java), so there is always some flexibility. But for most languages that don't have multiple levels of indentation by default and the custom of overly long names, 120 is more than enough to be a good guidepost.