DEV Community

Discussion on: Maximum line length in your code

Collapse
 
tpenguinltg profile image
tPenguinLTG

For code, I tend to use 80 as a soft limit and 132 as a hard limit (with rare exceptions): 80 so that I can easily have two or more views side by side, and also in the very rare case that I need to put the code on paper, and 132 so it doesn't get too unwieldy (I think 132 was the traditional limit for landscape paper, too). I also tend to code with line wrapping enabled, so horizontal scrolling is not usually an issue.

For in-code documentation and comments, as well as plain text documents, 72 because that's a comfortable width to read, especially in a terminal.

For more text-centric documents that are meant to be rendered like HTML or LaTeX, I don't usually impose a limit because it's awkward to have to readjust paragraphs just so they fit in a certain width, and the source isn't meant to be looked at by the end user. Line wrapping is a must here.