5 ms·
do we really have to limit 80 chars now? don't we all have bigger monitors and wider screens to accommodate 120 perhaps?
by maskedinvader 4y ago
do we really have to limit 80 chars now? don't we all have bigger monitors and wider screens to accommodate 120 perhaps?
- dmitriid 4y agoOn a wider screen you will probably have several code windows/panes side by side. So, back to 80 characters :)
- nickjj 4y agoYep. If you run 2560x1440 at its native resolution you can fit (4) side by side code windows at 80 characters with a very readable font size. Having 120 character lines only lets you have 2 (3 will cut off the last one by a decent amount). Being able to comfortably open 4 files side by side is like having access to a completely new world compared to 2. You can often fit the entire context of what you're working on in one visible space. I use 80 characters for mainly this reason and it's also no extra time spent when using languages like Python because Black will auto-format it for you, it comes down to running 1 command and letting the machine do all of the work.
- helge9210 4y agoWith 80 chars you could fit three windows with code side by side on standard screen or four on ultra wide.
- LudwigNagasena 4y agoDon’t we all have IDEs that enumerate lines and allow wrapping?
- okamiueru 4y agoNot sure what you mean. Soft wrapping?
- omegalulw 4y agoOther than the reasons already posted, I find it much easier to read code with 80 char line limits vs longer. For me it's like the benefit of reading an article in columnar format - going down vertically just feels more comfortable.
- ignoramous 4y agoWhile it might be true that 120 chars are ideal for screens [0], the consensus is an optimal line length is roughly 50 to 75 chars. [1] [0] https://www.viget.com/articles/the-line-length-misconception/ https://www.viget.com/articles/the-line-length-misconception... [1] http://webtypography.net/2.1.2 http://webtypography.net/2.1.2
- kozd 4y agoThat seems to apply for blocks of text. I don't know that the same would hold true for code.
- shakezula 4y agoWhat is code if not blocks of text
- tpush 4y agoA tree of nodes.
- shakezula 4y agoAnd we model sentences the same way
- cjg 4y agoOften significantly more indented.
- YokoZar 4y agoSentences feel different from lines of code. "One statement doing one thing per line of code" seems a reasonable idea but "one sentence per line of text" seems a bit absurd.
- kitsune_ 4y agoYeah but line formatting usually includes white space indentation in the calculation of the line length, I don't know whether you can 1:1 translate findings from normal text paragraphs like that. With linted code the actual relevant length might only be 20 characters, maybe we need some smarter linters.
- corford 4y agoEven Linus seems comfortable with 100 these days: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... On my team we've settled for either 100 or 120 depending on language.
- nicogg88 4y agoWhen you take into account IDE stuff like file tree on the left, plugins on the right, or the split view when looking at a file diff, more than 80 char is too much even on a large monitor in my opinion.
- BeetleB 4y agoI almost always have multiple files open side by side. Lines longer than 100 characters start wrapping which really hurts readability.