Coding for Amateurs

Posted on Monday, February 27th, 2012 at 5:02 pm in

Bumped into this code the other day. Hmmmm…

//b_paint_good is a boolean set somewhere else
IF NOT b_paint_good THEN
   //do not do something here
   [code follows]
   // do something here
   [more code follows]

Now what’s the point of this? Trying to raise the defect count on your software (in the immortal words of Wally “I’m going to code me a mini-van”).

Never code the negative boolean value first. If it’s the only condition you have to code for fine but never if you code for both.