3 ms·
Hah, this reminds me of my C++ professor requiring a max line width of 80 characters. My first question was “why not more!?” aswell. He would have the homework
by JimBlackwood 3y ago
Hah, this reminds me of my C++ professor requiring a max line width of 80 characters. My first question was “why not more!?” aswell.
He would have the homework submissions compiled to LaTeX and printed out - then he would write comments by hand. 80 characters was what would fit on a line. If you had more characters, lines wrapped wrongly and you’d get incorrect looking code - so he refused to grade.
I’ve since warmed up to the max line width idea. It’s nice to be able to read code on a small width window (I’ll rarely have a single full screen window with just code) and ensure each line is a valid syntax (and not unreadable due to softwrap in the editor). But I still think 80 chars is a bit extreme. 120 is nicer in my opinion.
- sgarland 3y agoOn my docked laptop with a quad-split 43” 4K, I am definitely in the camp of wider is better. Then I pull out my 13” Air and remind myself that there are reasons for limits. For Python, I just default to black, which is 88 chars. Easier to not argue with people that way. Plus, I’m free to write it with super wide columns if I want, and then let my precommit hook fix it.
- i80and 3y agoOpinionated formatters are the way out of this. Black, as you mention, is a godsend. I'm really disappointed by how weak the dotnet formatter is in comparison.
- dahart 3y ago80 char limits used to be very common in school and business, I’m old enough that most of my professors preferred it, and most students actually did too. My first programming jobs required it as well. There were a few students who felt limited, or had fun intentionally acting flippant or incredulous about these limits when their screens were more than 80 chars wide. The rule is slightly anachronistic now, and originally came from the time when CRT terminals (and printers) were 80 columns of text, and there was no graphical window manager. The rule was primarily about making code comfortable to read for everyone involved, to meet the minimum display with of anyone in the group. If you have a wide display but I don’t then it sucks for me. Plus I’m pretty sure that when I first started programming, a lot of printers and text editors and a lot of software wasn’t very good at handling long lines and characters would get mugged or discarded. Almost everything today will just wrap and display reasonably, but that wasn’t always the case back in the days of ed/edlin and earlier. These days I hardly ever hear about width limits anymore, though it does come up every once in a while when people have to work a lot in terminal or ssh sessions. I do have to drop into Linux non-graphical mode all the time, and even edits files and build code sometimes, and code that’s wider than the display is less fun to wade through. People still like having a reasonable limit, like we’d definitely get complaints if we start writing code that’s 500 characters on a line, right? :P
- funcDropShadow 3y agoIndependent of the origins of the 80 character line lenght rule. Some say it originated on punch cards. It is a useful rule. Classical news papers also have narrow columns. Why? Because it helps reading.