Rubber Duck Debugging
A familiar situation: you spent the last couple of hours debugging and you got nowhere. Time to reach out to a more experienced colleague. So you start typing up the problem, you go through everything you found out so far and all the steps you already took in trying to solve it. Very nice. You send it and in turn interrupt them as they spend five minutes on reading your mess(age). Meanwhile, about five minutes after you sent it, sometimes even already while typing it up, it hits you. You just figured it out. But why? Why was your brain able to figure out this problem now but not before?
Well, by explaining it to someone else and laying out all the details you gained a new perspective on the problem.
Great that you solved the problem, but the slight downside is that you might have already wasted the valuable time of a co-worker by taking their focus away from what they were working on. Instead of interrupting them, you could have used a rubber duck. Or any other inanimate object that cannot run away, when you start explaining your bugs^^. In my experience, the eMundo rubber duck is the best for this kind of job. No, of course I’m not biased at all.
Let’s examine a different situation; you could spend an hour talking to your precious rubber duck after which you finally solve a problem, or you could bother your trusted senior developer who could solve it in a fraction of that time. However in the context of the project, their time is way more expensive than yours, plus they have to stop whatever important things they are doing just to solve your small issue.
So how exactly do you go about rubber duck debugging?
(Also called rubberducking)
It is certainly not an ordinary occurrence talking to a rubber duck, let alone explaining complex concepts to it. At least not for the average person. But hey, we are software engineers here.
First off, if you have not already done this, accept that it is perfectly normal to talk to a rubber duck. If you are in an office full of your colleagues they either understand this perfectly well or you will be able to educate them on the wonderful merits of talking to your rubber duck. If you are working from home it’s even easier as long as you have an area to work alone… otherwise your co-residents can also learn about this amazing technique, as it can be used in many areas of life.
Now that you are comfortable with the idea of talking to your precious rubber duck, look deep in its eyes and start explaining your problem. Begin by outlining what you are trying to achieve. Then lay out what your approach to the solution is. I promise, your rubber duck will be listening attentively. Continue by explaining your implementation line by line, detailing every step you took along the way and why you did it this way. Rubber ducks are very interested in the nitty-gritty details. You might be surprised how quickly you can identify what exactly the problem (and solution) is.
This debugging technique enables you to solve many problems on your own and allows you to feel the accomplishment that comes with it.
For more info on that topic check out rubberduckdebugging.com.