Lazy and Sloppy Developers

October 14, 2009

Developers, please think of the poor SOB that has to maintain your code 2 years after you leave the company. I just ran in to a block of code that did not make any sense. It read “if(includeBlahItems) {do something}” that obviously only runs if there are some Blah items right?. Wrong! In this code, the boolean value called “includeBlahItems” only gets set to true when there were NOT any BlahItems to deal with?!?!

Please don’t do that. Rename the variable, or set it to false when there are not any Blah items and change the if block to “if(!includeBlahItems) {do something}”.