Next: None. Up: Testing and debugging. Previous: Large-scale testing.


Debugging

Hand traces

Tracing through the code by hand, to see how variables change, is extremely common - much more common that you might initially think. It's just much easier to trace through the code than to repeatedly recompile and run a test case.

Print statements

Adding print statements is another useful technique. You may think that it's antiquated, but it's in wide use and will continue to do so. It's just so simple.

Some useful tips for deciding where to put your print statements:

Debuggers

There is another tool called a debugger. I don't want to overemphasize its usefulness - I use a debugger far less frequently than I use hand traces and print statements. But a debugger is still often useful.

Good debuggers have at least the following two features.

Forte has a debugger built into it. I'll demonstrate it in class.


Next: None. Up: Testing and debugging. Previous: Large-scale testing.