Hacker News new | past | comments | ask | show | jobs | submit login

65-80 for readability however once you introduce indentation this naturally increases. I always felt that shorter lines were a good way to encourage less nested code. Alas after all these years the consensus is against me.



I still like 80 columns even on modern hardware and displays. It encourages me to keep my lines tidy and to break long lines apart. Sometimes I go a little over, but it's a nice target to reach for.


Completely agree on limiting yourself reducing the nesting of code.

There is more difficulty working with code such as

if x { //... } else { //... }

Than code like

if x { // returns from this block } // execution continues

In some legacy code I sometimes encounter very long chains of checks which nest 4-8 layers, which becomes very difficult to maintain a mental model of where you are in execution at any point. I try to refactor into the second pattern from above when possible.


agree. i think google python formatter kept lines at 65, i was surprised but it made you keep things concise & ended up much more skimmable.


i'm with you




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

Search: