The final step in the debugging process is putting a fix into place. It's often much harder than it sounds, especially in the case where you just don't feel like your going theory really captures the problem. A good fix must clearly arise from that theory and too often this part gets botched, and a debugger will convince themselves that their theory is wrong because their attempted fix didn't appear to do anything, when really the problem is that the fix didn't actually address the cause as described by the theory.
Ultimately, fixes are a kind of data collection, albeit a special one. It is the data collection that tells you whether you've ultimately understood the problem or not. When you apply a fix, one of few things happens:
- The problem disappears, and never reappears
- The problem disappears, but reappears under an apparently different set of circumstances. In this case, it's possible that your theory and therefore your fix was too circumscribed.
- The problem goes away but another problem appears. At this point there is a tough judgement call to be made: is this new problem something that was being covered up by the previous issue and therefore should be treated as a fresh investigation, or is your fix itself faulty simply causing the problem to morph instead of disappear?
- The problem appears to be unaffected. In this case you need to decide whether your theory or your fix is the problem.
Returning to the question of what a good bug tracking system ought to do, it should do a better job of helping you track this information in order to make a decision. If the problem reappears under a different set of circumstances, or morphs into a different problem that you think is similar in nature, you may want to open a new bug at first, but then merge it back into the original bug once you figure out what is really going on. On the other hand, when a bug apparently reappears based on observed symptoms, often the underlying cause is totally different, and being able to break that new information out into a new bug would be ideal, but perhaps with a link based on the symptoms so that if they reappear, you can quickly look at previous theories along with their fixes. That last piece is really the most important thing: bug tracking systems generally don't give you a way to list all the things you've tried that you thought might work along with the outcomes. Many times I've found myself thinking that I had a great idea for a change to the system that wasn't possible at the time, but if a certain fact were no longer true, it would be a much better solution.
In the end, keeping a good record of what you have fixed and how will pay dividends, both in terms of beating recurring problems when you accidentally undo something, and in terms of brainstorming when you are stumped. I'm hoping to incorporate some or all of these ideas into a new bug analysis system to be described in this space shortly.
