ARTICLE / Rubber Duck Debugging

The Only Co-pilot You'll Ever Need

It can be lonely out in cyberspace, Major Tom, especially during these remote working times.

Sometimes you need someone to talk to. Someone to argue with. Someone to blame. Someone to be mentored by.

In my team, we’re the stewards of Github Copilot for the organization, but I’m considered the old man yelling at clouds. Call me old fashioned, call me a traditionalist - but who needs modern expensive junk, when you can have a rubber duck?

Yeah, you heard me. A rubber duck.

My rubber duck is Jimi Duckrix, and our story goes way back. I was a lost and nervous junior dev, walking through the streets and canals of Amsterdam. When I stumbled upon the most amazing store. A store full of mentors and senior dev-makers: Amsterdam Duck Store. And the rest is history. Within a few months, I was a senior developer, ready to take on the world.

But what I’m really talking about?

A proven concept actually - Rubber Duck Debugging.

Here’s how it works:

  • Buy, manufacture, borrow, blatantly steal, or somehow obtain a rubber duck.
  • Place said duck on your desk and ask it if you can talk it through your code.
  • Give the duck a summary of what the code is supposed to do, and then proceed to walk it through your code line by line.
  • Before you know it, you will find that what you’re telling the duck the code is doing, is not what it’s doing at all. The bug is found, and about to be squashed.
  • The duck will just sit there stoically, pleased with its contribution to yet another happy dev.

Alright, so let’s be serious for a second.

The concept of Rubber Duck Debugging was introduced in “The Pragmatic Programmer", by Andrew Hunt and David Thomas. If you break your code down in parts and view the problem from a different angle, it makes your brain switch approach from the usual programming mindset.

It requires you to pay attention to the smallest of details, slow down for a minute, and stop taking things for granted. The fact that you’re not bothering your genius coworkers for every issue, and take a proper stab at solving the problem yourself first, is of course a given plus.

Your rubbery partner in crime has immaculate patience and wants nothing more than to hear you ramble on about infinite loops and incorrect types.

As you practice explaining your code to the duck, you'll become better at communicating your problems, explaining your code and, expressing your thoughts. And who doesn't want that?

Praise be to duckies!