Skip to content

Why are debuggers useful?

Tip

A debugger is a tool for examining the state of a running program.

Debuggers are useful because they show us what the code is actually doing.

Many of the errors that take a long time for us to find are relatively simple once we find them.

We usually have a hard time finding these errors because:

  1. We read what we expect to see, rather than what is actually written; and

  2. We rely on assumptions about where the mistake might be, and our intuition is often wrong.

Here are some common mistakes that can be difficult to identify when reading through your own code:

  • Using an incorrect index into an array, matrix, list, etc;

  • Using incorrect bounds on a loop or sequence;

  • Confusing the digit "1" with letter "l";

  • Confusing the digit "0" with letter "O".