The march of the rubber ducks
How can a rubber duck help you be a better programmer? How can they possibly have a place in our classrooms?
When I first heard about this strange phenomenon, I was a little sceptical. Is this just another gimmick? Is there a surplus of rubber ducks that need repurposing? No, apparently this is a recognised programming technique that really works.
What do you do?
You need enough rubber ducks so that each pupil has their own duck. Amazon presently have them on sale of 10 for £1.56 which is just over 15p per duck and even without a spreadsheet I can work out, that’s cheap.
Once your ducks arrive you hand them out to your class who will think you are “quackers” – sorry couldn’t resist and neither should you in making your own duck based puns. Your year 10 class will give you a strange look as you hand them out, the class clown will then throw their duck at somebody and someone else will draw some comedy eyebrows on another.
However, once the excitement has died down and their curiosity takes over you ask them to name their duck. You may want to suggest a few names to avoid them all being called “Donald” or “Daisy”, my personal duck is called “Her divine highness Matilda Duckington” but you don’t have to be so grand (Matilda is a bit of a diva duck and so I had no other choice).
Once your class have named their ducks you tell them to talk to them. Again, you will get strange looks and a few obedient nervous pupils will stay their first tentative whispered “Hello”, close to where they approximate a rubber duck’s ear to be.
Explain to the class that, and this may be a shock to them, rubber ducks are not any good at programming. I am generalising of course but have yet to meet one who can do more than a simple “Hello world” program.
Get your class talking to their duck, it doesn’t really matter what they talk about but they need to get over their fear of talking to “Belinda”, “Duck Rodgers” or whatever bazar names they have created. One way is to ask them to explain to their duck the difference between a syntax, run-time and logic error. This should get the class looking nervously around and maybe even feeling slightly foolish but the earlier you can get them talking to their ducks the better.
Tell your class the ducks are there to help them with their programming and they must do the following:
Explain to their duck what they want their program or block of code to do
Explain each line of code to their duck, not just read it out but explain what it does.
Give them a few practice broken programs to have a practice with before they are finally let loose on debugging their own programs.
The science explanation
We think faster than we talk and so by talking out loud about a problem we also slow down our thinking and this can sometimes be enough to help a solution jump into our minds and we have that “eureka” moment. The problem with a “eureka” moment is you know what the problem or final outcome should be but you may not necessarily have any idea how to get there. That is another thing the duck can help with.
By saying out loud what you want the final outcome to be you are cementing that in your mind and as you then talk through each line of code it is easier to see where your logic might have gone astray.
As teachers, we know that when we are told to teach a new topic we don’t really know, it is when we sit down to decide how we are going to teach it (either by creating a PowerPoint presentation or a practical exercise) that we really learn the new topic in detail.
By explaining each line of code to the duck we are forcing ourselves to think about what we are reading in more detail, we automatically analyse it in greater details then simply reading it from the screen.
You don’t have to use a rubber duck of course; any inanimate object would work just as well. You could explain your code to your cup of coffee, a plant on your desk or even in extreme circumstances a non-specialist member of the SLT, although they are likely to dose off and start snoring as soon as you show them the pages of code you are trying to debug.
Have a go
Now you have read the theory try it out. Go ahead and purchase the cheapest rubber ducks you can find and then introduce your programming classes to the rubber duck debugging technique.
I have even developed a PowerPoint presentation you can use in your Python programming classes. You can download it for FREE from TES by clicking on this link, along with a few error ridden Python programs and the corrected code. What are you waiting for, order those rubber ducks now!