Power of Rubber Duckling
Introduction
In My School days, I spent time explaining concepts to my friends in a different ways. Also, I pretended to be a teacher to all my toys at home. Most of us remember doing this as kids.
As a mother, when I see my daughters repeating the same practices, I understand, it helps them better understand the subjects, especially when an eighth-grade girl attempts to teach trigonometry to her third-grade little sister, she is able to drill down the problems in a better way.
That's it. This is called the Rubber Duckling technique.
Rubber Duckling help to solve coding problems too.
What is Rubber Duckling practice
The term “rubber duck debugging” can be traced back to a 1999 book by Andrew Hunt and David Thomas called “The Pragmatic Programmer.” In the book, the authors describe a programmer who carries a rubber duck around and debugs their code by explaining it, line-by-line, to the duck.
Rubber duck debugging can assist you in resolving a code issue since it compels you to talk through all of your previous decisions and actions, perhaps revealing where you made a mistake. In addition, because we think faster than we speak, walking through the process can help you calm down and understand the overall picture of your code, making it simpler to discover issues.
In my first job, I was a junior on the team, one of my senior colleagues, whenever she needs to debug a critical issue, make me sit next to her and explain the things, most of the time I dont understand, and sometimes, I ask really a very basic question. In both ways, she finds the fix by herself and thank me.
This is where "rubber duck debugging" comes into play.
To be clear, it doesn't matter if the thing is rubbery or ducky; what matters is that it isn't you. However, we can skip considering our colleagues or friends working in the same technology. Still, most of the time We waste our teammate's time.
Why not humans?
Finding the right conversation partner is always not easy.
He/She must be a good listener.
It will be great if that person is unrelated to your field. If so there is a chance, both of you thinking in the same direction, Some might even view it as an impediment to the process and hinder you from discovering a simple solution.
How to use Rubber Duckling Technique
Anything can be your Rubber Ducking, even sometimes noting down is also a good hack. While noting things down, you can think in a more organized way about your problem statement.
It should be noted that rubber duck debugging does not necessitate the use of a duck. You may use whatever you want as long as it pushes you to describe your code slowly and thoroughly. While the goal of this exercise is to save your coworkers' time, I am sure your pet would be interested in what you have to say (if you prefer explaining your code to a live creature).
The key point here is how you explain your problem to this duck.
Explain the problem, code , flow , logic, and expected outcome.
Ducks are obsessed with details, so don't skimp on them!
If your duck friend hasn't noticed it yet, be sure to go through all of the intermediate stages and transitions in great detail.
Woohoo! You find the answer!. The reason I like "rubber duck debugging" so much is that you'll usually understand your problem while doing it. You might have made a small typo, operating on the wrong variable, and missed a control flow condition. Something will almost certainly be disclosed.
Because of the psychology of how humans interact, when you invoke your little rubber ducky, you are forced to think from a different perspective, and your problem may be highlighted quite simply.
The Psychology of Rubber Duck Debugging’s Effectiveness has two shift
First, when you verbally explain things, you're more prone to slow down and be more precise than when power-typing code.
In the second shift, in which you must work with the understanding that the rubber duck to whom you are discussing your code does not know as much about the problem as you do.
When stuck on a problem, rephrase the problem in different ways, and keep explaining the problem. You may surprise yourself with a solution.
Happy Debugging!
No comments:
Post a Comment