Debugging Programs

A debugger is a program that allows you to step through another program one line at a time. This is very useful when trying to identify incorrect code and analyze how a program "flows". Key concepts include: Breakpoints, Stepping, and Viewing data.

The debugger is a program that can run your program one line at a time. Thus the debugger can show you exactly how the computer sees your code.

You could think of the debugger as "instant replay" (or film review) in sports, allowing you to see "step by step" what happened in a given play. Coaches use this all the time to find the strengths and weaknesses of their team. The debugger does the same thing. It shows you what is happening in your program at any moment in time, and allows you to "step by step" through the program.

Proper use of the debugger is essential to finding semantic (logical) errors in how your program behaves. The debugger should be considered your best friend while programming (that is, unless you can perfectly visualize how your program will run in your head).

Like any tool, using the debugger will take practice, but it is well worth the investment. Using the debugger to find errors can greatly reduce the time it takes to perfect a program.

Posted on by