Re:Linus on Line Breaks (2020)
by throwawayboise on Sunday November 28, 2021 @01:35PM
(#29371508)
For 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.
W is the bare minimum, it’s a function and a conditional or loop, 3 or 4 is pretty common.
The 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.
Re:Linus on Line Breaks (2020)
by lgrapenthin on Sunday November 28, 2021 @05:02PM
(#29373476)
Why does code have to be "read like a book" to be considered "continuous text"? Of course code is continuous text.
No 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.
Re:Linus on Line Breaks (2020)
by lgrapenthin on Tuesday December 07, 2021 @10:32AM
(#29473493)
And 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.
- 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.