Solve Problems With Rubber Ducking

What is “Rubber Ducking?” The phrase was made famous by Andrew Hunt and David Thomas in the book The Pragmatic Programmer: From Journeyman to Master.  A book, by the way,  which is required reading for all coders.  In fact, it is time I reread it.  You may already be familiar with this term, but in a nutshell, the idea is that simply explaining a problem aloud often helps one come up with a solution on their own. In the words of the Pragmatic Programmer,

Place a rubber duck on your monitor and describe your problems to it. There’s something magical about stating your problems aloud that makes the solution more clear.

This is an effective approach to problem solving.  I’ve actually had a duck work by my side for years now.  He’s a good, patient, loyal duck.  Of course, you don’t need a rubber duck.  Some people use email.   In the process of meticulously documenting their problem, which will ultimately be shipped to all the smartest people they know looking for help, the solution comes to them.  Some people call a colleague into their office, point at the screen and say, “I’d like to get a second pair of eyes on this.”  The request for review comes along with a detailed overview of the problem which, in turn, begets an answer to one’s own question.  As they say in the book, it’s magical.I stumbled upon an Interview with Hunt and Thomas which tells a bit more about rubber ducking.  It’s a quick read and it’s worth a look.

Reading your source code aloud, or explaining it to someone else, has concrete and documented value, whether in a formal setting of code inspections, peer reviews or just chatting with your cube neighbor, said Thomas. “Have you ever done this? You stare at a piece of code for an hour, debug and debug, and finally, in desperation, you pull your friend in from his cubicle. You start to explain the code and how it works, but then …” (smacking his forehead) “Oh, that’s it!”The audience laughed again, and most of them were nodding ruefully. In fact, Thomas said, you can even resort to “rubber-ducking.” “I don’t know why it works, but it works. You put the rubber duck on top of your monitor. Then, when you’re stuck on something, you start explaining what the code does aloud to the duck.” And before you’ve finished the explanation, the solution comes to you. You smack your forehead, and politely thank the duck, he said to general laughter.

Why do I bring this up?  I am currently on a 6-week leave of absence from work spending time with my wife and new born son.  Prior to leaving the office a few weeks back, I dropped my duck off on a colleague’s desk without any advanced warning that a duck-sitter was needed.  I know the sentiment was appreciated, but I’m not positive the significance was understood.  As I mentioned earlier, you don’t need a rubber duck.  All you need is to willingly share your problems aloud.  I was this person’s rubber duck.  They always came up with the answers on their own, but not before giving me the opportunity to listen.  

I hope my duck is getting an earful right now…

* Update: Previously, I incorrectly credited Hunt and Thomas with coming up with the phrase “Rubber Ducking.”  In fact, it was Greg Pugh who coined the term.  Thanks to Ed Davies and his considerate comment for addressing my oversight.

Comments

  1. Strictly, as the footnote in the Pragmatic Programmer makes clear the term was coined by Greg Pugh. I shared a house in Fulham with Dave and Greg and an office with Dave in about 1980 and remember the original duck sitting on Greg’s 3270 terminal.

  2. Thanks for the comment, Ed. My mistake. You are absolutely correct. I just reviewed the text and credit should go to Greg Pugh. Perhaps I should have stated the term was made famous by Hunt and Thomas? Many thanks for the correction.

  3. I’ve been browsing online greater than 3 hours today, yet I by no means discovered any attention-grabbing article like yours. It is pretty worth sufficient for me. In my opinion, if all website owners and bloggers made good content as you probably did, the net can be a lot more useful than ever before.

  4. Hi there, just became alert to your blog through Google, and found that it’s truly informative. I’m gonna watch out for brussels. I’ll be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

closed