1.4 Repairing a bug
The final step in the debugging process is bug fixing. Repairing a bug is more than modifying
code. Any fixes must be documented in the code and tested properly. More important, learning
from mistakes is an effective attitude: it is good practice filling a small file with detailed
explanations about the way the bug was discovered and corrected. A check-list can be a useful aid.
Several points are worth recording:
- How the bug was noticed, to help in writing a test case;
- How it was tracked down, to give you a better insight on the approach to choose in similar
circumstances;
- What type of bug was encountered?
- If this bug was encountered often, in order to set up a strategy to prevent it from recurring;
- If the initial assumptions were unjustified; this is often the main reason why tracking a bug
is so time consuming.
2 General debugging techniques