The Naked Else – How I Hate Thee
I cannot express my frustration at seeing code like this:
if (isset($modifier)) { // Do some things. // And some more things. // Still more // things // to be done here. // There's a whole lot of things here! // Last bunch of things } else { // Do totally different stuff }
People. Comment your elses! I shouldn’t have to scroll up to read the if again just to figure out what a branch of logic does. This is a maintenance code nightmare, and simply adding a simple “// If validation has failed” will save all kinds of time and frustration.
Comments
Rafael Lages
AuthorI agree completely…