Using Mistakes to an Advantage

Opportunities for live debugging demonstrations while teaching programming

This is the third time I am introducing the C language via our “Programming For Modelers” course at CMS. The course is not just about learning a language, but learning to think about and develop programs. My way of teaching has always been developing programs right in the class, using a projector for the screen, and talking about the thought process and required information as I program. The motivation is to let the students see how thoughts and programs evolve, and how solutions are arrived at. However, it always carries a risk: I can make mistakes, and cause serious bugs in the programs. In spite of this, students being exposed to seeing programs being developed in front of their eyes is a great idea.

For sure, I did make a few mistakes along the course. My approach till the last year was to use all my might to get that bug out as soon as possible, so as to continue with the flow of the lecture as planned. And that meant thinking very fast and silently, leaving the students clueless for may be two to five minutes.

Thus mistakes and bugs were only diversions away from my lecture plan, to be got rid of as quickly as possible. I sincerely hoped before every lecture that I would write correct programs in the class right away.

This year I realized not only that such mistakes are unavoidable, but also that I need not treat mistakes as something just to be gotten rid of. After all, programming is as much about debugging as it is about designing. So I decided to use mistakes to an advantage: I would use them as opportunities for demonstrating the debugging process.

So now I make my debugging thought process explicit and conscious. If I find my intuition running way ahead of my explanation, I try to trace it and lay out all the thinking steps in front of the students. I try to demonstrate how one can pinpoint the problem. I try to take babysteps which are unnecessary for myself, but which I think would be useful for the students in order to get used to the process.

I have no quantitative ways to find out how much better this is, but I am satisfied with the result so far. In a sense, now I actually look forward to making mistakes in the class!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: