Rubber Duck Debugging The Digital Way

Anyone who slings code for a living knows the feeling all too well: your code is running fine and dandy one minute, and the next minute is throwing exceptions. You’d swear on a stack of O’Reilly books that you didn’t change anything, but your program stubbornly refuses to agree. Stumped, you turn to the only one who understands you and pour your heart out to a little yellow rubber duck.

When it comes to debugging tools, this digital replacement for the duck on your desk might be even more helpful. Rubber duck decoding, where actually explaining aloud to an inanimate object how you think the code should run, really works. It’s basically a way to get you to see the mistake you made by explaining it to yourself; the duck or whatever – personally, I use a stuffed pig– is just along for the ride. [platisd] took the idea a step further and made his debugging buddy, which he dubs the “Dialectic Ball,” in the form of a Magic 8-Ball fortune teller. A 3D-printed shell has an ATtiny84, an accelerometer, and an LCD screen. To use it, you state your problem, shake it, and read the random suggestion that pops up. The list has some obvious suggestions, like adding diagnostic print statements or refactoring. Some tips are more personal, like talking to your local guru or getting a cup of coffee to get things going again. The list can be customized for your way of thinking. If nothing else, it’ll be a conversation piece on your desk.

If you’re more interested in prognostication than debugging, we have no shortage of Magic 8-Ball builds to choose from. Here’s one in a heart, one that fits in a business card, and even one that drops F-bombs.


16 thoughts on “Rubber Duck Debugging The Digital Way

  1. A polyhedral dice with suggestions on the faces would probably achieve the same goal; i only mention it in case there’s a software bug that stops the digital one from working.

    1. Sometimes we will start to tell somebody your issue and come to the fix by yourself. This is because your using different segments of the brain to articulate it verbally. The point of the rubber duck is about doing this step without bugging your “local guru”.

  2. I have a rubber chicken that originated from the quote that “This thing is so messed up that the only thing left to do is wave a dead chicken over it.” Having had a long career in engineering with lots of lab time, the chicken has been replaced a few times since the rubber dries out and they disintegrate. The rubber chickens still last a LOT longer then a bio chicken and don’t smell as bad.

  3. Many decades ago when I was a COBOL programmer we had a (continually renewed) bag of oranges in the office that fullfilled the role. When puzzled by an error the analyst would pop the bag on the desk for us to describe the problem to. Amazing how often it worked. Gave the analyst a break from spotting the inevitable missing full stop.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.