Rubber Ducking ~ awfully simple, but works like a charm
What is Rubber Ducking?
Rubber Ducking or Dubber Duck debugging is the simple concept of explaining your code or your problem to a rubber duck.
Have you ever wanted to ask your question in Stack Overflow but didn’t need to post the question because you understood what is wrong while typing in the question? This is exactly what Rubber Ducking is. Well, not exactly, because you didn’t use a rubber duck, but you get the gist.
If you are stuck in a problem and cannot understand what the issue is, rubber ducking is one of the best ways to untangle yourself. The idea behind is to simplify and explain the piece of code or the problem line by line, so that you can clearly see where the problem lies.
The origin of the idea dates back to 1999 where “The Pragmatic Programmer”, written by Andrew Hunt and David Thomas talks about a developer carrying around a rubber duck. It has proven to be an efficient strategy in finding solutions to problems.
Why does it work?
The psychology behind it is pretty simple too. We work with computers, which are extremely fast and precise and we too, tend to follow it and think fast. But the human mind is not as precise as computers, because we are naturally forgiving. So we can loose track of certain understandings unconsciously and when those lost pieces are prominent enough, they can create a roadblock.
When explaining your problem to someone new, you make sure to explain all the details, from the beginning to the end, and without knowing, we trace back those forgotten bits and pieces to finally achieve that satisfying “Aha!” moment.
Does it have to be a rubber duck?
Of course not. While you can use an actual rubber duck if you’re comfortable with it, basically, the idea behind is for you to be able to explain your problem to a complete newbie. You can imagine you’re explaining your problem to a colleague, your dog, your coffee mug, or even as I mentioned above, writing about it in Stack Overflow.
You know how you trace back your steps, when you forget where you put something? This is exactly that for developers. We, as developers, are passionate about problem solving, so when we hit a wall, we tend to try hard and solve it rather than taking a step back. So let this be a kind reminder to practice Rubber Ducking to save the time you spend in distress.