In this post I will explain what "rubber duck debugging" is.
If you are hearing the term first time, you might be thinking "What an earth is that!?". And you are not alone. That was the exact reaction I had back when I first heard the term.
Even though it sounds silly it is actually one of the best debugging techniques out there. And it works on all languages and platforms.
I also made a video on Youtube explaining what rubber duck debugging is. You can watch it here.
Rubber duck debugging explained
The idea behind the term is that you have a rubber duck on your desktop and whenever you hit a wall or can't figure out a solution to your problem, you take the rubber duck and start to explain your problem to it.
This might sound stupid but it actually works. Think about it. Have you ever asked your co-worker or friend help for some problem and while you explain your problem and how your code should work, you actually have an "ahaa" moment and solve the problem while explaining it. It's the same thing but instead of you explaining your problem to a co-worker, you explain it to the rubber duck, quietly sitting and listening on your desktop.
This has happened to me so many times. It really helps to explain the problem and your code line by line to someone because then you get out of your own head and usually see things more clearly which in return really helps on finding a solution.
Origin of the term
Of course it doesn't have to be a rubber duck you explain your problems to. It can be some other object or even a pet. Only requirement is that it is right there when you need it and it can listen (not talk!).
The reason for the name of this method is that the book Pragmatic Programmer (must read for any serious developer) introduced this method and in the book a programmer would carry around a rubber duck, hence the name of the term.