Sitemap
Software-Engineering-Forum

Software-Engineering-Forum

Rubber Duck Debugging

--

Press enter or click to view image in full size

The other day, my son was waiting patiently to ask me something while I was on a call. When I finished and went to check on him, he simply said, “Never mind, I figured it out.” Curious, I asked what had happened. He explained that, while thinking about how to ask me his question, he ended up solving the issue with his code.

Have you ever had a moment where, as you started explaining a problem to someone, you found the solution half way through?

Get Dasun Perera’s stories in your inbox

Join Medium for free to get updates from this writer.

I once worked with a brilliant programmer who had a peculiar habit. The seat next to him was usually empty because he would mutter quietly to himself, the moment he is stuck with something while coding. It was distracting for others, so no one wanted to sit nearby.

This concept is called Rubber Duck Debugging. The term comes from The Pragmatic Programmer (1999) by Andrew Hunt and David Thomas. In the book, they describe a programmer who carries around a rubber duck and debugs their code by explaining it line-by-line to the duck.

The core idea is simple: when you explain a problem — whether to another person or even to yourself — you often uncover the solution in the process. The act of breaking down and organizing your thoughts helps you see the issue more clearly.

Talking to someone can be especially helpful because they may ask questions that force you to explain things in a logical order. This structured thinking often makes the solution visible. Even if no one is around, talking to yourself, duck, cat or to a plant can still work wonders.

--

--

Dasun Perera
Dasun Perera

Written by Dasun Perera

Head of Engineering - Digital Wealth Management at GTN Tech and Former Senior Vice President Engineering at Hitachi. 28-Years of Software Development/Management