Tuesday, March 05, 2013

When Do We Teach Debugging?

I spent some time debugging student code today. Actually I spend a lot of time debugging student code these days. It is not something I mind at all. I see it as taking advantage of teachable moments. I believe that Debugging is Good For Learning as I wrote last October. Somewhere in the last couple of days though I ran into this post - How to Debug – that John Regehr  of the University of Utah wrote a couple of years ago. It would be worth linking to just for the information about debugging that it includes.  But I was also struck by the early point he makes that we don’t really teach debugging in an organized fashion in school.

Oh of course we teach about using debuggers and we have students do a lot of debugging. But there is no course in debugging and few courses would show an actual unit on debugging in their syllabus. Where would it fit?

There are books on the subject. I just discovered this thanks to John’s blog and his recent post Four Books on Debugging. But a course on it? Not so much.

I wonder how much  of teaching debugging happens by an instructor modeling debugging? In large university courses with teaching assistants, lab assistants or other student aids this may not work that well. I suspect that these days, with little to no formal study of debugging, the best debuggers are those with the most experience – learning via the school of hard knocks. This means that student aids will be fine with helping on projects that they have seen before. Beginners seems to mostly run into the same beginner errors in both code and logic. But what happens when students go off the beaten path?

As someone who has been writing code for close to 40 years I have made and seen a huge number of errors. I like to think that gives me an edge in debugging. What I think I need to be more careful about though is showing students how I find the bug rather than just pointing one out. I try to do this to some degree already. When I see more than one or two students making the same error I talk to the class about what I see and why it is happening. Hopefully this makes some of the learning stick. This is easy with syntax problems and basic logic (like setting up a loop or Boolean expression incorrectly) but more difficult with logic errors.

I may have to get more structured with how I help students. Helping them figure out the error is likely to be a better learning experience than me finding it for them.

No comments: