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