Hacker News new | past | comments | ask | show | jobs | submit login

I'm glad that the terminal 80-character limit was mentioned and that humans struggle with longer lines. In fact, the optimal line length is 50-75 characters [1], which is just right for 80 characters with 1+ levels of indentation.

That last one is the reason why I still keep a hard 80-character limit on my own code, even though I have a 4K monitor, and a big one too (43 inches).

But doing so actually has a great side effoct: keeping an 80-character limit with a 4K monitor means I can have four files open side-by-side. [2] Or a file open in four different places. Or a file and its associated header both open to two different places.

It also means that I can see the code completely while debugging with four columns. [3]

[1]: https://baymard.com/blog/line-length-readability

[2]: https://gavinhoward.com/uploads/4cols.jpg

[3]: https://gavinhoward.com/uploads/4col_debugger.jpg




> the optimal line length is 50-75 characters

For prose.


For any studies about code? Until we have them, that's the best we have to go on.


Are there none?


I haven't found any. Have you?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: