Even though debugging is an art rather than a science, there are definite principles that guide its practice. We will discuss some of them in this section.
At least one of our rules, the Fundamental Principle of Confirmation, is rather formal in nature.
The following rule is the essence of debugging:
Fixing a buggy program is a process of confirming, one by one, that the many things you believe to be true about the code actually are true. When you find that one of your assumptions is not true, you have found a clue to the location (if not the exact nature) of a bug.
Another way of saying this is:
Surprises are good!
When one of ...