If you are going through our computer coding series, by now, you have learned the 5 crucial coding skills someone needs to be a good computer programmer. You also practiced the skills of decomposition and thinking from different perspectives. Today, we talk about debug, finding and fixing mistakes. Debugging skill is essentially problem-solving skill because you debug when the code is not working.
No matter how good you are at programming, you will always run into situations that the code is not doing what you want. In fact, almost always, the first run of the program doesn’t work, and it takes many iterations of debug to finally have the functioning codes.
It is important for kids to know that debugging is an essential part of coding. It usually takes more time on debugging than actually writing codes. Debug could be very frustrating. It requires persistence and strong critical thinking skills.
The objective for this debug unit is to teach kids:
1. Debug is an important part of programming
2. Some basic thinking skills and a process for successful debugging.
How to find where to debug
Debug is a complex task. The bigger the project, the harder it is to pinpoint problems and find mistakes. One thing to do is to learn common causes for mistakes. Debugging becomes a little easier if you know the potential causes. Some are due to thinking errors, some are simply typos.
Debug Step 1
Usually the first step in looking for “bugs”, is to look for typos. In many real coding, it is very common to see someone miss a semicolon, or a closing quote mark, or misspell a word. For this coding series, our goal is not teaching actual coding, but typos can be found outside coding too. In the printable game sheet, we have some examples that kids can relate to. You can ask kids to point out the mistakes and correct them.
Download the Coding Game: Hot Dog Coding Game 4: Learn to Debug
On TpT (works for VAT Countries): Hot Dog Coding Game 4: Learn to Debug
It is important to ask kids if they have made similar mistakes themselves. This will help them understand making mistakes in coding is very common, and good programmers are the ones who are good at finding mistakes, correcting errors, and solve problems.
Debug Step 2
If after correcting typos, the program is still not working, it is time to check the program by sections. This is another reason why it is important to break a big task into smaller steps, a skill we practiced in the 2nd game in the series. Once you have very well-defined steps, and you know what the ending point of each step is, you can check one step at a time.
If, after you run the code in first step, the ending point of the first step is not what is expected, then you know there are mistakes in the first step.
If the ending point of the first step is what expected, but the ending point of the 2nd step is not, then the mistakes are in 2nd step.
An example that is easy for kids to relate to is the Morning Routine practice. Using the sample routine included in the free template, if a child went to bathroom and washed hand, it is an indication that the he did everything right in the first step, Go to Bathroom. If he brushed his teeth, but did not end at going back to his bedroom, then something is wrong in the 2nd step, Brush Teeth. If he is not back to his bedroom as expected, there is no way he can perform the next step Get Dressed.
As you can see, the key checking points are the Ending Points of each step.
In the Hot Dog Coding Game 4, you will find several sets of codes with bugs. The game uses the same game board as Hot Dog Coding Game 2, except two added Ending Points.
Ask kids to run the codes by steps, one step at a time. By doing this, they will be able to identify the part of the code that have mistakes, and then focus on checking that particular part, and correct the mistake if they find it. You will find a set of correct codes as reference.
Download the Coding Game: Hot Dog Coding Game 4: Learn to Debug
On TpT (works for VAT Countries): Hot Dog Coding Game 4: Learn to Debug
Debug Step 3
After fixing identified bugs (coding errors), you must re-run the program, see if it works this time. If it does, great. If it doesn’t, go back to Debug Step 1.
There are a lot to teach about debug. For young kids, the key is to know coding is not an activity that you do it once and expect it to work right away. Checking and debugging is part of coding. When the program is not performing as expected, stay cool, because it is ok and it is normal. When it happens, all you have to do is to start the debugging process.
You can have a preview and download the game at iGameMom Store.
Download the Coding Game: Hot Dog Coding Game 4: Learn to Debug
Download from TpT (works for VAT Countries): Hot Dog Coding Game 4: Learn to Debug
Also available in Hot Dog Coding Game Series
This is the 4th game in our Hot Dog Coding Game series. For the whole series, please visit DIY Coding Camp at Home
For more coding resources, please visit Best Coding Learning Tools for Kids
You will also like Cool Coding Toys Kids Love
Coding games like these are a great way to help kids enhance their problem solving skills. Such skills are useful not only in school but also for life. Thanks for sharing such interesting games.
I love the idea of debugging! It’s so essential when working with code, but it also teaches kids to look at things from different angles in every part of life. These are valuable skills that can be applied out from the keyboard as well.
It is so true, Colleen. Debugging is essentially systematically figure out the mistakes, which is a critical skill for anything job.