Why Rubber Ducking is One of Your Greatest Resources as a Developer

Why Rubber Ducking is One of Your Greatest Resources as a Developer

Rubber ducking is more than just a funny phrase ? it is and has been for many developers, a godsend. Simple in its nature, yet powerful in its execution, rubber ducking can save you a ton of time when running into challenges with your code.

By definition, rubber ducking is short form for ?rubber duck debugging? and is simply a method of debugging code. Conceptualized from a book where a programmer carried around a rubber duck with them, and had to explain their code line-by-line to the rubber duck. Odd origination, brilliant concept!

Image for post

The method behind this concept really is very simple ? explain your code to someone or to an inanimate object, or to the sky (as long as you get those words out of your head!). This is so that you can try and break down what it is you are trying to accomplish with the code that has got you stuck in the first place. By doing so, you are being forced to get out of your own head and actually explain what is going on with your code. Very often, by rubber ducking a problem, a developer can run into a solution without having to do any Googling whatsoever.

Side note, while rubber ducking an inanimate object works tremendously well, why not take it up a notch and rubber duck with a co-worker or a friend? If you think explaining something to that cute orchid plant on your desk can work wonders, imagine how great it feels to rubber duck with someone else who probably has some awesome advice or insight into your problem too! You never know who has had a coding dilemma practically identical to your own, and has exactly the advice you need to resolve that challenge.

Image for post

On top of that, even rubber ducking with someone who has no experience with coding whatsoever can be a fantastic asset as well. By explaining your code to someone with no actual understanding of code, you are being forced to break things down into really simplistic terms, in a way that a beginner would understand. This helps to remove all the junk from your explanation, and hopefully demystify things altogether!

13