1.1 Localizing a bug
A typical attitude of inexperienced programmers towards bugs is to consider their localization an
easy task: they notice their code does not do what they expected, and they are led astray by their
confidence in knowing what their code should do. This confidence is completely deceptive
because spotting a bug can be very difficult. As it was explained in the introduction, all bugs stem
from the premise that something thought to be right, was in fact wrong.
Noticing a bug implies testing. Testing should be performed with discipline and, when
possible, automatically, for example after each build of the code. In case of a test failure, the
programmer must be able to see what went wrong easily, so tests must be prepared carefully. This
lecture will not cover the basic of testing.