DEV Community

Discussion on: Code style rules that are actually useful

Collapse
 
lonehawk77 profile image
Claudio Valerio

In the 90s I was a strong supporter of the 80 chars length rule.
Now I allow my team an myself to go up to 120, 'cause, you know, widescreens and high DPI. A longer line allows for better naming of vars and methods.

Collapse
 
vonheikemen profile image
Heiker

That's fair. Meaningful variables names are important. I actually finded dificult to go beyond 80 characters in a statement, unless of course I'm chaining methods or creating an object with lots of properties.

Collapse
 
okolbay profile image
andrew • Edited

80 (120) chars are not only for screen width IMO
you can have a very long if clause or 9000 nested fuction calls. this limit implicitly hints you, when line becomes unreadable, despite still fittimg into modern screens. Another point on widescreens is that I have project structure on one side and Gradle tasks on another, so code section is still not so wide ))

overall most of these advices are more of a clean code rather than code style.
CS is more about curly braces on same line in method declaration, indents etc. I would recommend you Clean code, if you havent read it already, I’m sure you will like it )