STUDENT LEARNING GUIDE

A beginner’s guide to debugging code

Debugging is a structured way to compare what you expect a program to do with what it actually does.

Make the problem reproducible

Record the input, expected result, actual result, and the smallest steps that trigger the issue. A minimal example removes unrelated distractions.

Check assumptions in order

Trace the program with a small input. Inspect variable values, branch conditions, loop boundaries, and function arguments. Read the full error message.

Change one thing at a time

Form a specific hypothesis, make one small change, and rerun the test. If the result changes, you have evidence.

Keep a useful test

Once fixed, add or retain a test for the behaviour that failed. This helps catch the same issue if later changes affect it.

YOUR NEXT STEP

Want to work through a topic together?

Tell us what you are studying and we will discuss a suitable session.

Request a session ↗