Rubber Ducking – Rubber Duck Debugging, is a debugging technique used in software engineering. A funny term, but very useful when you use it. It will help you save a ton of time when faced with problems around the lines of code you write.
By definition, Rubber Duck Debugging is a simple way of debugging code. It originates from a story in the book Pragmatic Programmer, about a guy who Coder always carries his Rubber Duck with and explains every single line of his code for that Rubber Duck.
The method around this idea is very simple, you try to explain your code to inanimate objects, such as the Rubber Duck. This helps you break through the issues you’re trying to perfect with your code. By doing this, you break out of your thinking framework, and really explain what is going on with your code. By repeating the Rubber Ducking technique, the programmer can handle the problem without having to Google it.
Note a little bit, instead of explaining your code to Sao Su Duck, you can completely explain it to your colleagues or friends who might give you useful advice if they have had the same problem. You really don’t know who has encountered the same problem, but try to explain to them how the code works.
In general, Rubber Duck is an inexperienced code, explaining it is the same as explaining to someone who doesn’t know how to code. This explanation helps you to apply easy-to-understand, non-technical terms, problems associated with the problem and avoid unnecessary details when dealing with the problem. ).
Now practice, explain your Rubber Duck to understand the code you are writing and the problem you are having. If you don’t have Ducks, try explaining to the tree on your table or Comtor in your project. I stopped to spend nearly an hour explaining the project and the coding terms for a Comtor with no IT knowledge.
There are a number of ways I also try such as:
- When you can’t solve the problem, go outside to make an iced tea, or take a nap.
- If you have a Code problem, have someone sit next to you, try to explain to them the steps you have taken with the code, describe the desired output and the problem you are having.
Hope the article will be helpful to you.