Understanding what a bug is and how to identify a bug.
When you write code it is easy to make a mistake. Explain that when we are talking about computers and coding, a ‘bug’ is just an error.
Activity: Depending on the age of your class, explain that a bug can either be as a result of an error in the the instructions (algorithm) you write or it can be that the instructions were wrongly represented by the code such as using the wrong symbol (syntax error) or just making a typing mistake.
When your code goes wrong, you need to check your algorithm and then check your code.
Write a list of instructions on how to do a simple task on strips of card or use the IWB. Put one instruction in the wrong place. Ask children to spot the ‘bug’.
Make a list of things with errors in and ask children to spot the error and correct it. You could also ask why they think the error happened. e.g
- 6 – 5 = 11 (sign is wrong)
- I took the fog for a walk (typo – should be dog but the keys are next to each other on the keyboard)
- 1,2,3,4,56,7, 8 (punctuation – the comma is missing)
- Alan, Will, Ceri, Dave, Ethan, Fred (names are in alphabetical order so ‘Will’ should be ‘Bill’)
- The first man on the moon (Neil Armstrong found that it wasn’t made out of green cheese (Brackets not closed – very important in coding)
You could also re-use the materials used in the introductory lesson on algorithms and move one of the instruction cards into the wrong order.
To finish up the lesson, older children in particular might like to know that the first official record of the use of the word “bug” in the context of computing is associated with the Harvard Mark II computer which was in service at the Naval Weapons Center in Dahlgren, Virginia. In September 1945, a moth flew into one of the relays and jammed it. The moth was taped into the log book alongside the official report which stated “first actual case of a bug being found.”
Ever since, the term ‘bug’ has been used to describe an error a computer program.
One Comment on “What are bugs? (All ages)”
With very young learners you could use easier ‘spot the bug’ sentences e.g. 1 + 1 = 5. I would also reinforce the use of the word ‘bug’ as opposed to ‘mistake’ as often as possible. They’d probably find this very amusing!