Rubber Duck Debugging

In software development, the Rubber Duck Debugging is a method of debugging code. This method is a popular, well-established programming practice.

Even veteran programmers often use it to find problems and issues with their code. When nothing else seems to work, “rubber ducking” has saved many programmers from tearing their hair out in frustration.


The name Rubber Duck comes from an idea in The Pragmatic Programmer (1999), a non-technical book by Andrew Hunt and David Thomas, that explores software development as a craft.

In one chapter, Debugging Strategies, the author suggests explaining the code line by line to an inanimate object, like a Rubber Duck, to accomplish this without an actual person.

With Rubber Duck Debugging, the idea is dressed up in a humorous way – the duck does not actually play any active role in the process. Again, it is the idea of verbal explanation that helps the developer to catch bugs in the code.

For instance, the programmer could be “showing the duck” how a loop aggregates a certain string variable, and realize that one of the parameters is set wrong.

Programmers can recognize fencepost errors and other types of errors while they are verbally going through the code and explaining it out loud.


The benefits of rubber duck debugging aren’t just limited to your immediate code issue.

Learning how to describe things in simple, clear, and concise language is an incredibly valuable skill that will serve you well in the workplace and in the rest of your life.

Share this: