Background reading · Technology
Bugs, and how to squash them
Why every programmer writes bugs, where the word comes from, and five strategies for finding and fixing them.
A bug is a mistake in a program that makes it do something you did not expect. Your sprite walks through walls. The score goes up by two instead of one. The game never ends. Every programmer, even the best in the world, writes bugs. What makes a good programmer is how calmly they find and fix them. Finding and fixing bugs is called debugging.
A real bug
People used 'bug' for faults in machines long before computers. But there is a famous story. On 9 September 1947, operators working on the Harvard Mark II computer in the United States found a moth stuck in one of its parts. They taped it into their logbook with the note 'first actual case of bug being found'. The team included computer pioneer Grace Hopper, who loved telling the story.
Three common kinds of bugs
Five ways to hunt a bug
Test like a player
You know how your game is supposed to work, so you play it the 'right' way. Real players don't. Younger children click everywhere, hold keys down and ignore instructions. That is why testing with real players finds bugs you never imagined.
Keep a bug log
Write down each bug: what happened, what should have happened, the cause and the fix. Over time you will notice you make the same kinds of mistakes, and you will start catching them before they happen.
Sources and further reading
- This day in history: 9 September (Computer History Museum) ↗
- Computer bug logbook photograph (Naval History and Heritage Command) ↗
- Code Club Aotearoa ↗
Written for Kōkiri Learn students in our own words. Check facts against the sources.