3 ms·
The 80 chars per line rule goes back way beyond the 70s and 80s. It comes from typesetting. If lines are too long, you lose your place when your eye moves on t
by pg 19y ago
The 80 chars per line rule goes back way beyond the 70s and 80s. It comes from typesetting. If lines are too long, you lose your place when your eye moves on to the beginning of the next line. Many years of experience showed that about 70 chars per line was optimal for text. It might be slightly different for code.
- ivankirigin 19y agoI don't read code like I read prose. A line of code tends to be a logical unit. For example, breaking up arguments passed to a function across multiple lines, just because you break the 80 char rule, doesn't make sense.
- bootload 19y ago"... For example, breaking up arguments passed to a function across multiple lines, just because you break the 80 char rule, doesn't make sense ..." A good argument for concise languages?
- ivankirigin 19y agoIt is indeed.
- attack 19y agoWhat's wrong with breaking up function arguments onto multiple lines?
- ivankirigin 19y agoPlacement of the arguments. I sometimes group them logically, but more often than not, I just want the call to occur on a single line. The reason fewer lines is better is that you can see more of the code at the same time. That's why flipping a monitor vertically is a good idea.
- dfranke 19y agoCorrect me if I'm wrong but I think the origin of the 80-character width in computers is actually from the width of the first punch cards. AFAIK it was just an arbitrary decision not related to typesetting. The optimal width generally quoted by typesetters is 66.
- pg 19y agoYes, that's true. I was referring to the custom of cutting lines at about that length, not where the specific number 80 came from. Though in fact the 80 char convention probably wouldn't have made it past about 1950 it hadn't been a reasonable upper bound for lines of prose.