Finding and Fixing Bugs
Year 2 learn what bugs are and how to debug a simple program step by step.
# Finding and Fixing Bugs
A bug is a mistake in a program. The word is used because one of the first computers had a real insect stuck inside it that caused an error. Today a bug means any instruction that is wrong or missing.
Bugs Happen to Everyone
Even grown up programmers make bugs every day. Bugs are nothing to be ashamed of. Finding and fixing them is a normal part of programming, and it is called debugging.
How to Find a Bug
Run your program and watch carefully. Notice the first step that goes wrong. That is where the bug probably is. Read that step and the one before it. Often a missing step or a wrong direction is the cause.
Fix One Thing at a Time
Change only one thing, then test again. If you change lots of things at once, you will not know which fix worked. Patient, careful changes are the secret to good debugging.
Debugging Without a Computer
Write a sequence of instructions for a dance, but put one step in the wrong place. Ask a friend to follow the dance and find the bug. Laughing at the silly result is half the fun, and it teaches you to spot errors quickly.
Related Resources
Need worksheets for this topic? Generate a personalised worksheet or browse our collection.

