rubber ducky on a desk

Since it mysteriously appeared in my office five years ago, I have kept a rubber duck on my desk.

It’s not just for decoration, and this post will attempt to convince you why you should go out and get a ducky too. I did have to remove the mechanism that made it go “quack” for the sanity of those around me, though.

Rubber Duck Debugging

explaining code to rubber duck

The term “rubber duck debugging” was coined by Andy Hunt and Dave Thomas in their book, The Pragmatic Programmer. The idea is simple: when you’re stuck on a problem, you should explain it to a rubber duck.

If you are a programmer, I’m sure you’re familiar with this experience: your code doesn’t work and you have no idea why (or the scarier version of this: it does work and you have no idea why). You try to explain the problem to a coworker or even someone who has never written a line of code in their life. As you’re explaining the issue, you come up with the solution and rush back to your computer, leaving the other person a bit confused.

This is the situation we should try to emulate when explaining our code to our rubber duck friend.

Learning by Teaching

There are more benefits to explaining your code than just the obvious problem-solving mentioned above. One of these benefits is that by explaining the code, you gain a better understanding of it. It requires effort and deep comprehension of the code if you aim to explain what it does, line by line.

This method has been used in pedagogy since antiquity, where students learned about a subject matter by teaching other students about it.

The Feynman Technique

Richard Feynman

There’s not much to say about Richard Feynman that hasn’t been posted on inspirational images all over the world already. To give you just the tip of the iceberg that is Feynman, he was a Nobel Prize-winning theoretical physicist with highly impactful contributions in countless areas of study.
Feynman famously had a notebook titled “Things I Don’t Know About” where he would choose subjects to study.
The so-called Feynman technique is a learning method based on the idea that you don’t truly understand something unless you can explain it to a child. Here’s how you can do it with a rubber duck:

  1. Choose a concept you want to learn about.
  2. Teach the things you know about it to a rubber duck.
  3. When you get stuck, go back to the source material.
  4. Simplify and use analogies to explain the concept.

Now, go out and get yourself a rubber duck. You can thank me later.

so long

comments powered by Disqus