Thursday, February 27, 2014

It’s OK To Make Mistakes

Me to a student the other day“Several other people made the same mistake. That is why I was able to spot it so quickly.” Invariably that statement gets a look of surprise. Students often think they are the only ones making mistakes. Girls are especially prone to this mistaken assumption for some reason. And yet beginners are always making little errors especially in syntax.

The error of the day last week was unnecessary semi colons after while statements. You know the ones that create a null statement that causes the loop’s block of statements to be outside of the loop. Anyone who has coded in a C-family language has seen that one. Visual Studio even provides a helpful warning in most cases. A warning students seem to ignore. Several students made this error in the same hour.

The day before I specifically called out this error as one of several I expected students to make. Warnings seldom seem to help. But that is ok. It gives me a chance for a teachable moment to explain (again) what is going on and how these languages “see” statements.

I’d rather see syntax errors and typos than logic errors BTW. I had one girl who was seeing a lot of errors. I showed her one syntax error she had made and all the errors went away and her program worked. As I told her, she had the logic all worked out just fine. She knew, in theory and mostly in practice, what she was doing. She just got bit by a rookie syntax error. And that I told her was ok. In fact my experience is that the longest lists of errors are often caused by the fewest of actual errors. A little thought and some patience and work will get through them every time. Giving up is the only real wrong.

cat on bugs
In the beginning syntax errors are the bane of most students existence. That is why drag and drop programming languages like Alice, Scratch, and the like (lots of them listed at Programming With Blocks) are so popular. But at some point we have to move to more general purpose languages where syntax becomes an issue.
Dealing from students frustrations or fears that they are failing is as much a part of teaching the first course (I think) as teaching the concepts. Fear is a killer. Students should not be afraid to try things and to make mistakes. Making mistakes is the real world. Letting them know that they are not alone and that everyone else is making mistakes can help. As long as you help them see the mistakes as a learning and growing experience and not as a personal failure.

I thank every student who comes up with an error I haven’t seen before. I explain that I learned from their issue and that is a good thing. And I mean it!


Dan Kasun said...

This is one of the reasons I love VB.NET. I find it one of the most forgiving languages syntactically (especially with VS2013).

Ken Bauer said...

I had a great learning opportunity today with my own syntax error in Python. I forgot that the string (or list) slice is done with a colon instead of a comma.

This let my students know that I am human and make mistakes. It also let the students see how I debugged the problem and found the solution in seconds (I had to slow down to let them watch and explain my process) via Google combined with a link into StackOverflow.

It was great.

Alfred Thompson said...

Dan, I'm totally with you one the forgiveness of Visual Basic. I see a lot more syntax errors in C-family languages.

Ken, showing students the debugging process can be very valuable. I need to slow down and do it more myself.

Mike Zamansky said...

I don't know if forgiving is the right word. JavaScript does semicolon inference which is forgiving but can really be a nightmare for beginners.

The key is meaningful feedback. Too much of a shield, kids don't learn. Too little, they get frustrated.

A system that provides good feedback (which can be really hard to find) and some rubber duck debugging can be a wonderful combination when developing young coders.