3 ms·
- Code is not prose. It's not read like a book so it's not clear that an "ideal measure for continuous text" is at all relevant. - Most lines are short even if
by Diggsey 5y ago
- Code is not prose. It's not read like a book so it's not clear that an "ideal measure for continuous text" is at all relevant.
- Most lines are short even if the limit is more than 80 characters, so you're unlikely to accidentally shift up or down after reading a long line.
- Even if there turns out to be some benefit for reading code based on Saccades, that means nothing unless you can make some quantitative comparison with the other advantages and disadvantages of a longer line length.
- throwawayboise 5y agoFor me it's not just the length of the line but the level of indentation. I think wide indents are good for readability, so if you're using standard tabs and also sticking to 80 columns as a hard limit then you have only 64 characters to work with at two levels of indentation. Excessive indentation is a clue that you may want to refactor, but two levels is pretty common. 80 charcters starting at the point of indentation is more reasonable. At two levels of indenting, you might get out to 96 characters, which still fits comfortably in most GUI terminal windows.
- AlphaSite 5y agoW is the bare minimum, it’s a function and a conditional or loop, 3 or 4 is pretty common.
- xxpor 5y agoThe biggest problem with short lines isn't even the line length, it's that it encourages stupid variable names in order to keep things on one line. Silly abbreviations that no one new to the code can figure out are the bane of my existence.
- lgrapenthin 5y agoWhy does code have to be "read like a book" to be considered "continuous text"? Of course code is continuous text.
- tasogare 5y agoNo it's not: a book is generally read from cover to cover (at least fiction) while code is split amongst various files. One is free to read them in any order, which is the opposite of continuous text.
- lgrapenthin 5y agoAnd like with files, you are also free to read chapters of a book in any order. But files have little to do with lines, no? Of course a function definition in every sane language is continuous text, even though you "are free" to read it backwards or starting in the middle.