DEV Community

Cover image for What is Rubber Duck Debugging?
Joe Eames for Thinkster

Posted on

What is Rubber Duck Debugging?

You’ve been banging your head against a virtual wall for what seems like a month, and you are no closer to getting your code to actually do what it’s supposed to do. What now? Perhaps a new career? Something less frustrating like crash test dummy sounds pretty good all of a sudden.

Ok, you take a quick breath and realize that maybe you can get help from a coworker. Someone to come look at your code with you and help you find the problem. That is actually a proven recipe for success. Just the act of explaining in clear terms what you’re trying to accomplish in your code will lead to you discovering the problem, and the other person often doesn’t even need to really participate, they just need to listen.

Only what do you do if you work alone? Or it’s late at night and nobody else is with you? Or your only coworker is on vacation following the Grateful Dead around on tour?

There is another solution, that is proven to be 83.29% as effective as an actual human. And that is the rubber duck.

image

Yes, pull out your trusty rubber duck and set him/her/them/it on your desk and proceed to explain your code and how it works to Mr. Ducklesworth.

If you’ve never been exposed to this technique it can sound dumb, and even thinking about doing it may make you feel silly, but what is your priority? Looking as cool as David Hasselhoff or getting your code into production?

Don’t believe me? Here’s a great writeup on the psychology of rubber duck debugging.

So get your favorite artificial waterfowl, keep him handy, and when necessary, lay out your technical problems on his very capable and water-proof shoulders.

Happy coding!

Signup for my newsletter here.

Visit Us: thinkster.io | Facebook: @gothinkster | Twitter: @gothinkster

Top comments (0)