News for hackers. Stuff that matters.
Re:Is the 80 character line limit still relevant? (2008) by rusk on Tuesday November 19, 2024 @06:44PM (#42189290)
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.
Re:Is the 80 character line limit still relevant? (2008) by accrual on Tuesday November 19, 2024 @07:04PM (#42189434)
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.
Re:Is the 80 character line limit still relevant? (2008) by anonymous_union on Tuesday November 19, 2024 @06:49PM (#42189334)
i'm with you
Re:Is the 80 character line limit still relevant? (2008) by DeliriousDog on Tuesday November 19, 2024 @08:32PM (#42189978)
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.

Re:Is the 80 character line limit still relevant? (2008) by tariksbl on Tuesday November 19, 2024 @09:41PM (#42190371)
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.