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.
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!