<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1639164799743833&amp;ev=PageView&amp;noscript=1">
Diagram Views

How a Rubber Duck Taught Me to Be a Better Programmer

Joe Mayberry
#Code
Published on September 15, 2014
warren-wong-323107-unsplash-1

Programming is complicated, but sometimes inspiration can come from unlikely sources. Learn about an unorthodox tool for developers: the rubber duck.

It sounds silly, doesn't it? A rubber duck? It's a bath toy that your kids play with in the tub. It has no hands, and is made of rubber (actually plastic now-a-days, but that's just a technicality. It has always been, and always shall be a rubber duck, no matter what it's made of!). What's a rubber duck got to do with programming? And how can it teach me anything?

Programming is hard. Don't let anyone tell you differently. When you write a program, there can be anywhere from one to a gazillion lines of code, and you are going to make mistakes. Sometimes they're big, sometimes they're small, but no matter the size, they all take time to find and troubleshoot. Sometimes, you need help. Sometimes, you need...a rubber duck.

Enter the Duck

I first learned about the concept of Rubber Duck Debugging from Deane Barker (@gadgetopia). He mentioned it in his excellent blog post "How to Give a Good Conference Talk", where he described practicing a presentation out loud, in order to make it better.

The idea of using something, be it a rubber duck, your pet hamster, or the stuffed pink panda bear you won at the county fair, as a sounding board for working through a problem is not new. Almost every business community learns about it eventually. It's surprisingly simple, but verbally explaining the issue you need to solve or the problem you are trying to overcome can often give you exactly the inspiration you need to figure it out.

Even if you're not a programmer, Diagram's team can explain how to improve your website. Sign up for our Mini UX Review to learn about any usability issues that exist on your site.

But Don't We Already Do This?

Sure, you can get help from another web developer, and I often do (extra bonus points if you can get said developer to dress up like a rubber duck while you are explaining your problem. Keep asking. It'll happen…), but that takes up their valuable time. If I had a penny for every time I have fought, yelled, and cursed at my program because it didn't work, only to have someone else take a look at it and say something like "you missed a <comma, semi-colon, variable, reference, etc>," in under a minute, I would have at least $28.37. Then I feel like an idiot, because I couldn't see that one little thing.

The great thing about using a rubber duck is that it doesn't take up someone else's time. The rubber duck doesn't judge you, and it is very patient as you work through the issues.

There Is Actual Science at Work Here

There is something magical about explaining your problems out loud, even to something as inanimate as a rubber duck, that can help you see the solution to your issues. Magic aside, there is even some science there as well. (See The Psychology Underlying the Power of Rubber Duck Debugging for a more in-depth explanation.) The act of speaking out loud forces you to slow down and be more precise and thoughtful in your explanations. After all, the rubber duck doesn't know what you know.

When you go through code line by line, explaining each part to the rubber duck, you pay closer attention to the small details. You don't gloss over things that you "just know" are there, and instead you pay attention to what is really there. Often times during this process, you see a problem that you missed before. It's very similar to the idea that you only really start to understand a topic when you try to teach it to someone else.

What My Rubber Duck Has Taught Me

Ninja Duck
My rubber duck, the "Green Ninja" (Image credit: Tara Mayberry Teaberry Creative)

Here are some of the important lessons I have learned from using Rubber Duck Debugging during my website development work:

  • I have learned to be more clear and concise when I am describing a problem.
  • I have learned to be more careful while writing code, so that I don't have to bore him with a lot of extra troubleshooting sessions.
  • I have learned to make a better effort to troubleshoot the issues before bothering my co-workers.
  • And finally, I have learned to be more patient when someone uses me as a sounding board to work through their problems (but I won't dress up like a rubber duck).

So go out and find your own rubber duck, be it the classic yellow bath toy, or one dressed up like a pirate — pick one that you're comfortable with and fits your personality. My Green Ninja rubber duck sits in a place of honor, where I can see him at all times. I talk to him, ask questions, explain my problems out loud, and I don't bother my co-workers as often as I once did. He helps me realize that I know more than I think I do, that I am better than I think I am, and not nearly as clever as I want to be. He just sits there smiling his enigmatic smile, waiting for me to come up with an answer. He is my constant companion when I am writing code, and we work together to develop better websites for our clients.

Top Image Credit: Deposit Photos