Dropping if-bombs

On June 25, 2012, I tweeted:

I believe I just coined a new programming term: if-bomb: adding a bunch of heinous if’s for a special case “Dropped an if-bomb on my code”

To be clear, this is a well-known anti-pattern, covered in Patterns of Enterprise Application Architecture by Martin Fowler. I started calling them “if-bombs” to discourage their use. One remedy is the Special Case pattern, but there are others. A special case of the Special Case pattern is the Null Object pattern, which is used when the special case handles null references.