Rubber ducking: how to get unstuck

I was first introduced to the concept of rubber ducking while attending the DevLeague bootcamp.

The concept comes from the book The Pragmatic Programmer and has become a classic method for debugging code. But it’s not just valuable for software developers; this practice helps people problem solve regardless of industry or job title (and even outside of work).

What is rubber ducking?

It happens to everybody: in the midst of writing code, you get stuck. Nothing you try is working quite like you expect it to, and you can’t figure out why.

And that’s where the rubber duck comes in.

Instead of pulling out your hair or throwing up your hands, you begin to talk to the rubber duck. You explain what you’re trying to do. You describe what you expected to happen and what is happening instead. Then you explain what you’ve done, line by line.

Somewhere during this process, a lightbulb goes off and the answer becomes obvious. In explaining your code to the rubber duck, your brain is able to clearly see the problem and the solution. And you’re able to solve it without having to interrupt someone else.

Why does it work?

There are many theories for why this practice works. It could be that while trying to explain something well, your brain is able to identify the gaps in your current code. It could be that by simplifying your thoughts to be able to explain them to a brainless inanimate object, you eliminate the cruft and can see the solution more clearly. Or it could be that by moving your brain from focused thinking to diffuse thinking, your brain is able to make connections for you.

Maybe it’s all of the above!

Thoughts disentangle themselves over the lips and through the finger tips.

Dawson Trotman

What does rubber ducking look like in practice

While the term rubber ducking was coined for the practice of talking out development problems with a duck (or other inanimate object), there are countless ways we practice this in real life. Here are a few examples from our team:

Brian, project manager:

“Writing often clarifies my thinking or solves the puzzle I’m thinking through.”

Ron, developer:

“I draw diagrams on paper to try to isolate the bit that needs figuring out. It’s similar to trying to put the problem into words, only using pictures instead.”

Joel, partner & developer:

“I find that when I’m writing a comment in a pull request or Basecamp thread posing a question about how something should work, as I write out my question, solutions often present themselves through the clarity that asking the question brings.”

Alan, CEO:

“I try to explain it like I’m introducing a new concept to my 10-year-old daughter.”

Jenn, project manager:

“I will often go for a walk with my bluetooth headset on and my phone in my hand—as if I’m on a call—and talk through the problem out loud.”

Of course, talking to a coworker can also be valuable because it forces you to put your question or problem into words. It also allows them to ask clarifying questions and help you brainstorm solutions.

If you can’t explain it simply, you don’t understand it well enough.

Albert Einstein

Frequently asked questions

Why a rubber duck?

Because rubber ducks make you happy. They’re just something fun and cute to talk to.

Do I need a rubber duck to do this?

While rubber ducks are cute, there’s nothing magical about the duck itself. The idea here is to give you an audience as you process your thoughts out loud, but you could just as easily talk to another inanimate object, a pet, or a coding buddy.

Do I have to talk out loud?

The important part of this practice is to either talk out loud or write out your thoughts. This gets you out of your head and forces you to clarify and organize your thoughts, which leads to insights and solutions.

It may be that extroverts, who are typically external processors, prefer to speak out loud as they process, while introverts, who process internally, prefer to write out their thoughts. There’s no right or wrong way to do it, though—try a few different things and see what works best for you!

Won’t I feel silly talking to a rubber ducky?

You might! But don’t be afraid to sound stupid. Just get it all out of your system. The brain is like a dirty tap—you need to flush out everything before the clear thought comes through.

Leave a Reply

Your email address will not be published. Required fields are marked *

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