Re:The tyranny of the Hollerith punched card
by patrickmay on Monday June 06, 2016 @09:53AM
(#11846734)
50-75 characters is the optimal line width for the human eye to scan: http://baymard.com/blog/line-length-readability
[ Parent
| on HN ]
Re:The tyranny of the Hollerith punched card
by falcolas on Monday June 06, 2016 @10:10AM
(#11846860)
I think the biggest problem with translating this into code widths is that we use indentation liberally. Seeing 6-12 characters taken up by whitespace is nowhere near uncommon.
So, given that, perhaps 80 characters isn't so tyrannical...
Re:The tyranny of the Hollerith punched card
by vertex-four on Monday June 06, 2016 @10:46AM
(#11847136)
I've seen code where 20-odd characters were taken up by whitespace. Of course, at that point, you really want to split it out into different, named functions... code like that is unreadable for entirely different reasons than line lenth. Similar things the case for almost every single case where a line might become "too long" - I don't think the length is actually the issue so much as the complexity.
Re:The tyranny of the Hollerith punched card
by andrey_utkin on Monday June 06, 2016 @11:16AM
(#11847371)
but "20-odd" (let it be 24) is just 3 * 8, which is something like this. I don't see how this is already screwed up for complexity.
class A
{
A::a()
{
if (expr) {
do1();
} else {
do2();
}
}
}I think most people have converged to 4 space tabstops, so 24 spaces means 6 levels of indentation.
Re:The tyranny of the Hollerith punched card
by sixothree on Monday June 06, 2016 @01:57PM
(#11848789)
Namespace, class, method, loop, conditional brings us to 20.
Re:The tyranny of the Hollerith punched card
by vertex-four on Monday June 06, 2016 @12:18PM
(#11847894)
I don't actually know of any project which uses 6 or 8 characters per indentation level.
Re:The tyranny of the Hollerith punched card
by andrey_utkin on Monday June 06, 2016 @12:46PM
(#11848124)
8 chars is default tab size. So e.g. "git diff" shows you 8-position tabs. Github (and Bitbucket, etc.) diff visualizer also shows it as 8 positions. Any editor should use 8 by default, too.
And, believe me or not my space-loving friends, tab-indented codebases still exist.
Re:The tyranny of the Hollerith punched card
by khedoros on Monday June 06, 2016 @02:34PM
(#11849095)
My first change to any editor is to set tabstops at 4 characters. That's the standard policy at my employer, and I like it for my own projects, as well.
Re:The tyranny of the Hollerith punched card
by vertex-four on Monday June 06, 2016 @12:58PM
(#11848226)
My editor definitely puts tabstops at 4. Weird.
Re:The tyranny of the Hollerith punched card
by OneOneOneOne on Monday June 06, 2016 @10:23AM
(#11846970)
For code it also seems most of the text reside on the left. Opening an extra wide window to display text for the occasional long line seems a waste of screen space.
Re:The tyranny of the Hollerith punched card
by mnw21cam on Monday June 06, 2016 @10:39AM
(#11847089)
Indeed. The rule for prose is that a text block width should be somewhere between 2.5 and 3.5 full alphabets. This takes into account the variable spacing of different characters. This is to strike a balance between having inconsistent space or too much hyphenation (if the line is too short) and the eye's ability to find the next line when scanning leftwards from the end of the previous line (which is difficult if the line is too long).
Code is different in several ways. Firstly, code is generally shown in monospace typeface. Secondly, breaking lines too early can be even worse for code than for prose. Thirdly, even with a long line limit, code will generally have lots of short lines anyway, and this helps the eye find the next line when reading. The long lines (as long as they aren't all long) stick out from the rest of the code text, making it easier to read.
That's why your editor has soft line break capability.
Re:The tyranny of the Hollerith punched card
by LionessLover on Monday June 06, 2016 @11:06AM
(#11847286)
First, we are not reading text but code.
Second, we code very differently then we used to - several layers of indentation are common now but were not when the limit was seen as reasonable.