When children learn to code, they’re learning a set of new things such as variables, data types, operators, conditionals, and loops. With all of these things, once they write some code, they expect something to popup and do something worthwhile for their efforts, but all they see sometimes is an error message (not applicable to all courses). And, that can make them feel – Oh! All of this work and I still get an error message! Does my teacher know how to teach?
As important as to learn to write good code, it is extremely important to build the intuition of debugging the code. At the same time, it is important to not overwhelm and slowly transition students into the world of debugging. Debugging can be very inquisitive to some and can be a bit daunting to some. Debugging requires energy and for some that energy comes from inquisitiveness and for some it comes from patience. You have to understand the student and his or her nature here and accordingly inspire them into debugging the code.
The Full Circle with Debugging
Once you teach debugging, you complete the full circle of solving problems through programming. Understanding warnings and error messages and building the foundational thinking to solve for them is what is the real test of your programming skills and knowledge.
Therefore, it is important to introduce students to debugging organically along with writing code. Ask questions on why the particular error or warning is coming. Initially, most newbie programmers are told to ignore the warning messages as they don’t stop you from executing your programs. However, the devil lies in the warnings. While not at the beginning, it is important to understand what the warnings are trying to convey and how to write more efficient code for reduced time and space complexities and readability.
Sometimes debugging can be a point of avoidance for children: if a student faced a negative experience or is not very comfortable with errors and warnings, it can lead to reduced confidence in coding and understanding of basic tenets of programming and lead to a set of unsuccessful attempts of debugging, into a downward spiral. So, one has to enable children to not fear errors and warnings and that errors and warnings are faced by the best programmers in the world.
Fixing Errors and Warnings
It is important to educate children with the models of common errors and warnings – the “Why” behind those errors and warnings and “How” to fix them in the code. These could be common errors such as syntax errors, type mismatch errors or warnings, variables not initialized, and others.
Traditionally, the errors and warnings are not very easily understandable unless you start to become familiar with a particular compiler or interpreter. The modern large language models (LLMs) are being implemented to bring a more humane way of describing errors and to also help explain how to fix those errors and warnings. LLMs will help more and more in this aspect and will enable ease of programming and debugging.
Hope this is useful, thank you.
You may like to read: Ethical Hacking & Cybersecurity for Juniors, Making Scrolling Background in Scratch, Coding a Basketball Game in Scratch, & Math that children need to build CS applications