Remember one of Murphy’s laws? It says: if something looks dumb, but it works, then it’s not dumb at all. The same rule applies to rubber ducks and… software development process. Learn more about the concept of rubber duck debugging.
Imagine the following situation: you cross the threshold of a software house and enter the world where dozens of people are tapping the keyboard with a stubborn face. Everything is fine. It’s a software house after all, right? Now take a closer look at them. Yes, your eyes are not deceiving you. This guy in the second row is just talking about his code… to a rubber duck.
Not only for bathing
The developer is just using one of the best methods of debugging in the software industry. Because rubber duck method is simply a way to debug your code. Relatively long time ago, the duck became a symbol of support for programmers at work. The need to have an inanimate object is due to the fact that when you come across a code error, the best way to identify and remove it is to think aloud.
To understand how the duck helps us, we must realize that the computer thinks precisely and rationally. The same issue is a bit more complicated with human beings – we think about many things, we focus on many threads and at different times we come up with different ideas. The rubber duck method closes the gap to some extent.
It’s really all about telling our duck what we wrote – line by line, we tell the toy about what in theory (or rather – in our opinion) does the exact code snippet. Describe the methods and ideas that were the basis for creating the program. It is nothing but thinking out loud. It is thanks to it – and the support of a rubber listener – that you can most often find a typo, correct a variable, or discover an incorrectly defined class. Most of the errors that appear in the created program result from the usual oversight or vague instructions that you present to the computer.
There is a method in this madness
Why does talking to a rubber duck even work? It’s really simple: when saying something aloud, line by line, you focus your attention on the details. You do not skip any, even the most obvious, fragments. When debugging with the duck method, you are one hundred percent precise. It means you have the precision a computer requires to do its job. In a nutshell, a thorough analysis of each fragment out loud allows us to finally see what we have overlooked by hanging over the lines of code for several hours. And then it’s time for the loud: “Of course!”.