Late this afternoon (is there any other time for things to go wrong?) I found myself hunting down a bug. I found it, and when I did, I had one of those, “how in the world could this have gone unnoticed” moments.
Specifically, how in the world could this have gotten by our unit tests?
I found that, too. It turns out that there used to be a unit test that would have caught precisely this error, and someone had commented it out. Most readers at this point are either asking, “what’s a unit test”, or exclaiming, “Duh!”. For the rest of you, here’s a free scrap of wisdon to tuck away:
If a unit test fails, commenting it out does not count as “fixing” it.
This makes roughly as much sense as a miner watching his canary drop dead, and fixing the problem by chucking the canary corpse in a hole. After all, if he doesn’t see the bird anymore, then there’s no problem, right?
Come on — get real.