DEV Community

Hadeel Salah
Hadeel Salah

Posted on

A Rubber Duck A Day, Keeps The Sneaky Bugs Away

You may be shocked to see a Path toy as a methodology and still wondering what is the connection between a rubber duck and software engineering? Well, this toy has a deep story. Let's explore it together.

What Is Rubber Duck Debugging?

The term rubber ducking is the shortened term of a rubber duck debugging which is a method of debugging code where you explain the problem or the concept line by line for a rubber duck that won't judge you.

How To Implement Rubber Duck Debugging?

Bring the rubber duck to your desk, then start by explaining what the code is supposed to do. After that, describe when the error has happened. For example, in the runtime or while you still writing the code. Then, try to trace the code and explain it aloud line by line to the rubber duck till you finish. After that, describe what are the approaches that you followed to fix the problem and what approach works and not works.

Rubber Ducking Under The Hood

Well, the Rubber duck is not a silly concept or merely a path toy. Actually, it hides a strong methodology that has been used in our life without a specific concept. How? Let's go with the following example for more clarification.
Assume that you want to clarify how the sound comes through the headphone to a curious 10-years-old boy, what will you do is describing all the processes precisely with the exact details in a proper way that suits his knowledge level as I explained in the previous topic.

The same strategy will go when you try to figure out a solution for your code problem after spending a lot of hours reading the code over and over to find a sneaky bug. Once you try to explain it out loud without skim-reading or glossing over the details, you force yourself to analyze the code until you find the bug.

Rubber Ducking Benefits

  1. Helps you to solve the problem by yourself, which is a great way to enhance your skill in problem-solving.
  2. Reducing Impostor Syndrome -there's an article about this concept below-.
  3. Helps you to solve better since you tried to explain the code line by line to the duck.
  4. Gives you a good opportunity to discuss your mistakes without being judged.

Final comment|

Never give up trying.

If you have any comments or questions, don't hesitate 🙏🏻


Top comments (0)