Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I 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.


"... 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?


It is indeed.


What's wrong with breaking up function arguments onto multiple lines?


Placement 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.


Correct 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.


Yes, 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.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: