If you have spent any time around software developers, you have probably heard someone mention rubber duck debugging. It sounds absurd. You explain your code to a small plastic duck sitting on your desk, and somehow, that helps you find the bug. The technique has a devoted following across the software engineering world, and for good reason: it actually works.
What is rubber duck debugging?
Rubber duck debugging is the practice of explaining your code, line by line, to an inanimate object. Most commonly, that object is a rubber duck. You describe what the program is supposed to do, then walk through each step out loud as if teaching someone who knows nothing about programming. No software tool required. No colleague needed. Just you, your code, and your duck.
The term originates from The Pragmatic Programmer, published in 1999 by Andrew Hunt and David Thomas. The book described a programmer who carried a rubber duck and explained their code to it whenever they hit a wall. The story spread through developer communities and became one of the most widely recognized concepts in software engineering culture. Stack Overflow even launched a satirical April Fools feature called Quack Overflow in 2018, a nod to how mainstream the concept had become.
Why does it work?
The technique works because of how human cognition handles complex reasoning, not because of anything special about the duck.
Working memory has limits. The human brain can hold roughly five to seven items in working memory at once. Silent debugging routinely exceeds that ceiling, causing the brain to skip logical steps and make assumptions. Those skipped steps are precisely where errors tend to live.
Speaking out loud externalizes your reasoning. Once a thought is spoken, you can evaluate it from the outside rather than holding it inside your head. You stop relying on recognition and start reconstructing. That shift is where the problem-solving happens.
There is also something called the Protege Effect: the act of explaining a concept to another entity, even an inanimate one, activates the same cognitive pathway as teaching. Teaching demands deeper processing than reading or scanning. You are forced to rebuild the logic from scratch, which is exactly what surfaces the gaps.
Finally, switching from typing to speaking activates different neural pathways. That context switch interrupts the mental loop that silent debugging tends to reinforce and creates the cognitive distance needed to see the problem clearly.
How to do it
The steps are straightforward, but the details matter.
Start by placing any stationary object on your desk where you can address it directly. State the goal out loud first: what is the program supposed to do, and what is it doing instead? Then walk through the code line by line, explaining each operation as if teaching someone with zero programming knowledge. Do not summarize. Do not skip lines. When you reach a step that does not sound right as you describe it, stop. That gap in your own explanation is typically where the bug lives.
If the first pass does not resolve it, restart from the beginning with slower, more deliberate verbalization. The object does not need to be a rubber duck. A coffee mug, a stapler, a houseplant: any stationary, non-responsive object will do. The duck is the culturally recognized prop because of The Pragmatic Programmer, not because of any unique property of the duck itself.
Rubber duck debugging vs. pair programming
Both techniques share the same underlying principle: articulating a problem forces clarity. But they serve different situations.
Pair programming involves two developers working at one workstation. It is best suited to architecture decisions, knowledge transfer, and problems that genuinely require a second domain perspective. Rubber duck debugging is available at any hour, creates no social friction, and involves no scheduling. For isolated logic and reasoning errors, it is faster, lower-cost, and often more than sufficient.
A practical rule: reach for the duck first when the problem is a logic or reasoning bug you can trace step by step. Escalate to a pair partner when the rubber duck has failed after two full passes, or when the problem is architectural rather than logical. Developers who normalize rubber duck debugging as a first-pass diagnostic arrive at pair programming sessions with a clearer, more specific problem statement. The duck makes the pair session better, not redundant.
The physical duck on your desk
Most developers who use the technique consistently over time end up formalizing it with a dedicated object on their desk. A physical anchor makes the habit intentional. The rubber duck has also become a recognized symbol in developer culture: a small but consistent signal that the person at that desk takes their debugging process seriously.
If you are curious about how other developers approach this and what kinds of ducks end up on professional desks, the complete guide to rubber duck debugging covers the full technique, the psychology, and the most common questions developers ask about getting started.
Does talking to a rubber duck really fix bugs?
Yes, and the cognitive science backs it up. The technique is most effective for logic and reasoning errors. It will not resolve every bug type, particularly environment-level or dependency issues, but for the problems where a developer is stuck inside their own assumptions, speaking out loud is consistently the fastest way out.
The barrier to trying it is essentially zero. Any object on your desk is enough. Explain the problem out loud before you ask a colleague or open a new browser tab. The solution is often already in the explanation.
Have you tried rubber duck debugging? Leave a comment below with your experience, whether it worked, what you used as your duck, or the strangest place it helped you find a bug.
About the Author
Alex M. is a senior software developer with over ten years of experience in backend engineering and developer tooling. When not writing code, Alex writes about developer culture and the small habits that make engineering teams more effective. Alex keeps a programmer-themed rubber duck on their desk, sourced from Le Petit Duck Shoppe, a specialty collectibles retailer in the Old Port of Montreal carrying Canada’s largest selection of collectible rubber ducks.














