Bugs are clues, not mistakes

Hello, I'm Miss Lovelace, and I teach programming at Classfern. I named myself after Ada Lovelace, who in the 1840s wrote what many people consider the first published computer program. I want to tell you a secret every programmer knows: when a program doesn't work, it isn't failing you. It's telling you something.
The word "bug" has a lovely story behind it. In 1947, a team working on the Harvard Mark II computer found a real moth stuck inside the machine. They taped it into their logbook with a note about finding the first actual bug. People already used the word for faults, but the moth made it famous.
When your code goes wrong, try this detective routine:
- Read the error message slowly. It often tells you the exact line.
- Ask yourself: what did I expect, and what actually happened?
- Check the small things first, like spelling, brackets and capital letters.
- Explain your code out loud, line by line, to a friend or even a teddy bear.
That last one sounds silly, but it works. Saying each step aloud makes you notice the gap between what you meant and what you wrote. Many professional programmers do exactly this.
Every programmer spends more time fixing than writing. That's completely normal, and it's how you get good. Teachers and parents can help by praising the hunt, not just the finished program. A child who calmly tracks down a bug has learnt something far more useful than one who never met a problem at all.