News for hackers. Stuff that matters.
Re:Stop Writing Dead Programs (Transcript) by hoseja on Wednesday October 19, 2022 @03:18AM (#33258758)
Optimum for whom? Nineteenth century teletype operators? I never got that argument.
Re:Stop Writing Dead Programs (Transcript) by lou1306 on Wednesday October 19, 2022 @03:39AM (#33258899)
It's related to how reading and the human eye work. For each eye fixation, you take in about 5-10 characters. The optimal line length for books is about 60-75 characters, which takes somewhere between 6-15 fixation to scan.

Code is not like books: most lines will be shorter than the "limit", there's indentation, you're typically reading monospaced characters on a screen, and you have syntax highlighting, etc. So, bumping the length up to 80 characters is still okay, as is the occasional outlier. But regularly writing 100-120 characters-long LoCs will definitely impact readability.

Re:Stop Writing Dead Programs (Transcript) by goto11 on Wednesday October 19, 2022 @03:34AM (#33258867)
Optimal for reading prose texts. I believe experiments have shown the optimal line width for reading speed and comprehension to be about 50-60 characters.

But as far as I known this have only been researched for reading prose. I doubt the result will translate directly to reading source code, which is read in a completely different way.

Re:Stop Writing Dead Programs (Transcript) by fermigier on Wednesday October 19, 2022 @04:42AM (#33259299)
Yes, experiments are lacking for code, but I believe the physiological principles (eye fixation, etc) still stand.

Also: the optimal line width for prose seems to be 50-75 characters (including whitespace). Source: https://baymard.com/blog/line-length-readability

Assuming you're using a language where indentation is either mandated (e.g. Python) or recommended (e.g. C with "One True Braces"), with 4-spaces indentation (here again, no experimental evidence, but this seems to be the norm nowadays), and you don't abuse cyclomatic complexity in your functions / methods, you have let's say between 2 and 4 indents on the left so 80 is close to the optimum.

Note: up to 100 is probably still OK from a readability POW. But this assumes that all readers are able to increase their window size from the default 80. That's probably true for people using GUIs, but may still be problematic for people with sight issues (e.g. people over 50 or with more serious medical conditions...).

Re:Stop Writing Dead Programs (Transcript) by jstimpfle on Wednesday October 19, 2022 @06:36AM (#33260116)
s/POW/POV/
Re:Stop Writing Dead Programs (Transcript) by lcnPylGDnU4H9OF on Wednesday October 19, 2022 @01:14PM (#33265115)
Reminiscent of tabs vs. spaces, this seems to be a new battle in an old war and readability is (allegedly) being held captive by both sides.
Re:Stop Writing Dead Programs (Transcript) by jstimpfle on Thursday October 20, 2022 @02:50AM (#33271592)
I don't know what you're talking about. You sure you replied to the right comment?
Re:Stop Writing Dead Programs (Transcript) by debugnik on Thursday October 20, 2022 @05:37AM (#33272467)
They're making a POW (prisoner of war) joke about the topic, I think.