The proper approach to fixing bugs

This is a concept I’ve been preaching recently. It’s very simple.

A bug indicates a failure to understand something. It might be a failure to understand what some code does, or it might be a failure to understand what the code should do.

If you simply try to make the bug go away, that failure to understand something will likely remain, and it will likely lead to new bugs.

What you must instead do is figure out what that failure of understanding was and rectify it. This will not only fix the bug, it will also prevent future bugs that would have emerged from that failure.

This entry was posted in programming on by .

2 thoughts on “The proper approach to fixing bugs

  1. Steven Shaw

    I’ve always thought it important to find the root cause rather than “whack-a-mole” bug fixing. You’re saying that sometimes the root cause is a fundamental misunderstanding (rather than a mistake such a off-by-one). After some thought I agree — sometimes you can even find that that your whole “model” of the problem is broken.

    1. david Post author

      Hmm. I don’t necessarily think that the misunderstanding has to be fundamental. To a degree even simple “Oops” mistakes are also misunderstandings. They’re often errors of omission – “Oh, I didn’t think about that”. In that sense even off by one errors are often of this type. It can also be things like “Oh, I didn’t realise that was a legal thing to do here”.

      The problem is definitely more severe (and more important to fix) when the misunderstanding is fundamental though.

Comments are closed.