We call it “The Usual Suspects”.
When you lose something, like your phone, for example, you look in likely places first - your pocket, your bag, by your keys- before you turn your room upside down.
The same common sense approach applies to code. The vast majority of bugs (mistakes in code) are the “Usual Suspects”, common errors.
When you prepare a list of these Usual Suspects ahead of time, you can review your list of likely bugs. This helps to prevent you from ending up being stuck in a never ending Where’s Waldo bug hunt (the hard ones at the end where it’s all Waldo lookalikes). This is also a useful technique for surgeons and everyday life (see The Checklist Manifesto by Atul Gawande).
There are 3 main types of bugs:
- Syntax: code was not typed correctly so the computer can’t understand it (e.g., missing a semi-colon)
- Logic: code was typed correctly but it’s not using the right strategy (e.g., using a for loop instead of a while loop)
- Style / Code Design: code technically works, but there’s a more elegant way to solve the problem
- It’s a great learning exercise for students to come up with their own list of Usual Suspects and for teachers to have their own lists prepared.
In Teach like a Champion lingo, they call this “Planning for Error.” Assume your students will make mistakes, so that you can be prepared to take action when it happens.
#ChecklistsForTheWin!