I’ve spent a good bit of time, online and in-person, lately talking to people about rubber duck debugging. It was one of the topics of my talk at CSTA NY recently. There was a lot of discussion about it at the end of my talk and the ideas flew around. I thought it might be a good idea to share some of what I have learned.
The basic idea behind rubber duck debugging is that before students ask their teacher for help on a problem they first explain what is happening to the rubber duck. By explaining what is happening and what should be happening to the rubber duck the student will often realize what they have done incorrectly. Explaining problems like this to another person is a common debugging technique for even professional developers. I should say, especially for professional developers!
What usually happens is that students are asked to first explain things to the duck. If that fails to show the correct result than the student is to explain it to a peer. Usually, but not always, to a person sitting next to them. Only than can they bring the teacher into the problem. Saving teacher time is a side benefit not the real goal though. The goal is to help students solve their own problems by carefully working at understanding what is happening in their code.
Does it work? Well, a lot of teachers swear by it. It is common enough that a rubber duck seems to be the unofficial mascot of Computer Science education. They were everywhere at several CSTA events that I have attended.
Teachers introduce and use the ducks in several ways. One of the most common is to issue a duck to every student. Some teachers even have adoption (aDUCKtion) ceremonies and certificates. The idea is to create a sense of ownership or teamwork with the duck. Making sure that the duck doesn’t just disappear into a backpack never to be seen again can be tricky. Some teachers require that the duck sit next to the computer or keyboard at the start of class for example.
Other teachers assign a duck to each computer and it stays there from class to class and student to student. Still others have a “duck pond” and students go to the pond to borrow a duck. Finding a system that works depends a lot on the school, budget, and student culture.
Getting students to use the duck is the next issue. Teachers have to be firm in asking students if they have talked to the duck first. There can be incentives of a sort as well.
One teacher told me about having ducks that quack. If a student talks to the duck and that solves the problem they can announce the fact by having the duck quack. Of course keeping the duck quiet at other times can be a classroom management issue. Again, something that works or not depends a lot on the classroom environment. Regardless, providing positive feedback for student success can go a long way towards getting students to use the technique.
One middle school teacher reported that quacking ducks would never work in a middle school. In my limited middle school teaching experience, I would tend to agree. This teacher uses duck stickers that are attached to student notebooks. The duck is not the magic, getting a student to talk out their problem and their code is the magic!
Getting students to read and analyze their code is a particularly important part of teaching computer science and programming these days. Arguably, in the day of AI written code, being able to read, understand, and explain code is more important than ever. If a rubber duck can help that is a good thing.
Last session of the day,From Python Pixels to Prompts. The software used in this session is from