Sunday, September 19, 2004

The Inverse Law of Bug Complexity

James Tauber has defined the The Inverse Law of Bug Complexity:
The harder a bug is to track down, the simpler the fix tends to be.
Sounds clever but I think this is self-deception. It just seems like they're simpler to fix when they're harder to find. In general, I find that most bugs are caused by simple errors. With new code, most of the bugs are "low hanging fruit": code just doesn't work properly. These are easy to fix. But as a software system gets more stable, bugs can become harder to isolate and track down. The thing that surprises most new programmers is that a simple bug can be responsible for incredibly complex and erratic behavior. You shake your head and say to yourself: "What the heck is going on here?" And when you finally figure it out, the simplicity of the fix has you shaking your head again. Or slapping your forehead. D'oh!