Rubber Duck Debugging

Rubber Duck Debugging

posted in productivity on  • 

Talk to the Duck

When confronted with a problem, don’t ask the person next to you for help right away, he’s probably doing something important as well!

Instead, first tell the duck about it - out loud. If you don’t get to a solution, start explaining your problem in more and more detail until it hits you. If the mere explanation led to a solution, you avoid unwillingly turning your colleague into a CardboardProgrammer.

Most likely the duck will just sit there and appear to have done exactly nothing. Does it get satisfaction every time it assists someone in finding a solution? We will probably never know.

More Frivolous

My family somehow turned Rubber Duck Debugging into “give Wouter as many ducks as humanly possible”.

The most magnificent duck I’ve received so far:

Ducky!!
At the office. The name is Ping, ask her anything!

Rubber Duck Prank

Warning: This stuff is hilarious.

Not at all relevant to rubber duck debugging but still very funny!

Further Reading

Pragmatic Programmers

The original idea was to blog about the Pragmatic Programmer Tips. The blog turned out quite differently however. Still, here we are, Rubber Duck Problem Solving, yet another thing I learned from the Pragmatic Programmers.

Tip 3: Provide Options, Don’t Make Lame Excuses
Before you approach anyone to tell them why something can’t be done, is late, or is broken, stop and listen to yourself. Talk to the rubber duck on your monitor, or the cat. Does your excuse sound reasonable, or stupid? How’s it going to sound to your boss? - Andrew Hunt and David Thomas

One final tip (in this context!) from them pragmatic programmers: “Don’t be afraid to ask, or to admit that you need help.” No one knows everything.

Coding Horror

The effort of walking an imaginary someone through your problem, step by step and in some detail, is what will often lead you to your answer. … Even if you don’t get the answer you wanted, forcing yourself to fully explain your problem will frequently lead to new insights and discoveries. - Jeff Atwood in CodingHorror - Rubber Duck Problem Solving

StackOverflow also did a April Fools’ Day joke in 2018 about this. Displaying a duck in the corner which, after some apparent thinking & writing, produced a quack.

WikiWikiWeb

At WikiwikiWeb they also have a RubberDucking page. They originally called it the CardboardProgrammer:

You’ve just spent the whole day trying to solve a problem, a design problem, a bug, etc. You know the solution is simple but you just can’t see it.

A colleague walks past and notices your anguish: “What’s up?”. “Oh, I’m …”. You explain the problem and what you have done so far. However you suddenly discover the solution before you have finished speaking! So far your colleague has been as useful as a cardboard cutout.

Other, similar techniques:

And to finish this post, a business idea from the RubberDucking wiki page:

You can even pair program with a rubber duck.
It would be perfect if you added a little voice chip that asked, “Did you write the test?


Other interesting reads
Tags: debugging