Teaching Python

We're two middle school teachers learning and teaching Python

Identifying and Teaching "Mistakes" to Help us Learn Code

I read an article recently, "Mistakes are not all created Equal," from Mindset Works. The article explains four types of mistakes worth understanding and identifying in your classroom. This article got me thinking about my process of how I teach "failure" in Computer Science.

Understanding and growing from "failures" or mistakes while learning to code can help strengthen your learners understanding of the benefits of failing forward, experimenting, and identifying intelligent failures.

At the start of every coding course, computer science teachers can benefit from explaining to students the process and skills of learning how to fail.



Most students' first reaction to using the word "fail" takes their minds to the gradebook and the repercussion that may be felt from their parents or on their GPA if they fail a class. However, explaining how mistakes can be used to enhance learning has many different advantages.

Not all mistakes are the same or have the same outcomes. When teaching the skill of "learning from failure," the first step is to make sure that we define and name the types of failures that occur. Using terminology helps students put this learning into context and understand them more. In addition to defining the types, identifying how each type of failure can improve and help students learn is equally important. However, be sure to differentiate and acknowledge the important difference between learning from mistakes, making silly mistakes, doing things haphazardly or carelessly, and making catastrophic mistakes like not doing our best during important life-altering events.


Let's define and explain the types of mistakes.

According to the article, there are "Stretch mistakes." "Stretch mistakes happen when we're working to expand our current abilities." The MindShift article discusses the Zone of Proximal Development, which is a good strategy for helping students "see the stretch" in a guided or facilitated way. However, I see more stretch mistakes and learning happen when students complete coding tasks of desirable difficulties independently. Unlike the learning that happens in the Zone of Proximal development, these learning mistakes happen when students attempt to tackle something independently and just out of their reach or challenging enough to produce multiple code errors or learning stretches. This type of learning failure also happens during the "Figuring it out Stages" of a learning cycle. Again, this is when students need to seek new knowledge and challenge themselves to find creative answers to problems.

Regardless of how a student gets there, stretch mistakes are good mistakes to make, and they should happen continuously during the learning process. They are not high stakes, they should not affect a grade, and if used correctly, they should invigorate students and inspire them to seek out more challenges during learning. This quote from Frank Wilczek summarizes stretch mistakes well.

"If you don't make mistakes, you're not working on hard enough problems. And that's a big mistake."

Another type of mistake is known as the A-Ha Mistakes. These are failures that are derived after outstanding learning achievements. In my class, we tend to call these the "Clicks and Metacognitive A-Ha's."

'Clicks' happen when a learner is practicing the "Thinking about thinking" or "learning how to learn" techniques continuously. During the lengthy process of obtaining knowledge, connections are made. The 'A-ha moment' is us, learning from what we did not know before and making connections between the new knowledge we have acquired and previously learned information.

The best part of these "Click" moments is that we finally realize the mistakes we had been making and the sudden "A-Ha" of understanding is invigorating. Through thinking about learning and reflecting on the process of learning, our mistakes become apparent, and a new neural connection is made.

"We must master many subjects in order to implement our dreams. Our personal journey begins by gathering appropriate learning experiences and awakening our minds to observe, evaluate, and recall what we experience."― Kilroy J. Oldster, Dead Toad Scrolls

As defined in the article, sloppy mistakes are those careless mistakes that happen because we are not paying attention. In Computer Science, newbie coders tend to make a lot of Name Errors or Syntax Errors.

Understanding that focus, particular processes, and coding habits need to be formed when you first start to code is fundamental. The bad news is that these sloppy mistakes are normal, expected and a regular occurrence when coding. Sloppy mistakes happen when you are learning something new and will always happen regardless of your experience. The good (and bad) news is that as a person becomes more experienced with coding, and even though the mistakes still happen, they will hopefully become easier to spot, identify, and correct.

Computers have no forgiveness for silly and sloppy mistakes, and programs will not run when you have an error. However, to help the process, teachers can guide the students in identifying sloppy mistakes made in code, discuss ways to identify and fix them, learn to read tracebacks better and more importantly, see the benefit of paying attention to small details. Students sometimes do not identify these mistakes, but pointing them out and acknowledging the opportunity to learn from the mistakes is very important.

As stated in the article, "sloppy mistakes can be turned into aha moments" if you embrace them!

"When given an AHA moment, Do not ignore it. Pay attention to it. Your mind is directing you to your truth" ― Christine Szymanski

Lastly, let us not forget about the mistakes that we should always try to avoid or, better yet, if not avoid, at least minimize the opportunity and quickly learn from them. These types of mistakes are typically tied to large consequences, like 'high-stakes" assessments or promotional goals. They can be stress inducing and in worse cases, they can also be life-threatening.

High-stakes mistakes can have a huge impact on meeting learning goals, growth mindsets, and sometimes our motivation. However, like all mistakes, a lesson can be learned from them. Limiting the opportunities of high-stakes assessments in your classes and minimizing the risks involved can help students find the benefit in learning from mistakes at lower costs. However, be careful of removing some level of stress or importance to assessments. Students still need to learn how to work under modified pressure with consequences.

No one likes to make mistakes; however, ensuring and teaching the skills to build reflection and growth in learning from mistakes can help prepare students on methods and techniques for learning from them.

"We need to accept that we won't always make the right decisions, that we'll screw up royally sometimes – understanding that failure is not the opposite of success, it's part of success."

― Arianna Huffington

It is essential that during your lessons, you continue to highlight the benefits of learning from failures. A teacher can help encourage this by avoiding multiple high-stakes assessments, providing multiple opportunities to challenge and stretch learning, and instead of focusing only on end goals, the focus is shifted to the process. Showing students what effective effort looks like during learning, that "stretch and a-ha" mistakes are teachable moments, and that no one is perfect is a great way to empower your learners; it is okay to remind them that everyone makes mistakes.

How do you encourage failures in your class?