![Hero Image](/_next/image/?url=https%3A%2F%2Fassets.tina.io%2Fac949295-6f4c-48ea-8f33-2f825ae90bf5%2Fimages%2Frubber-duck-debugging.webp&w=3840&q=75)
Rubber Duck Debugging
by Andreea Oproiu • over 1 year ago • 3 min read
Sure, working in software development is cool and all, but it can also give you a lot of headaches if you stumble upon problems you don't know how to solve first-hand.
Any software developer has been there: the code you wrote appears correct, and you think it should work, but it doesn't. Sometimes all it takes to fix something is a typo or a missing semicolon. Other times, it's not even your fault, all it took was updating to a new version because of a flaw in a library you're using. However, you've squandered a few days of your time, and you're getting impatient since the problem is taking so long.
Other scenarios can include bugs, broken code, complicated new technologies or even overlooking the little things — all aspects that can drive a developer crazy, lost among his lines of code.
Rubber ducky to the rescue 🦆
First question — have you tried to explain the problem to someone else? How about to a rubber ducky?
Many developers have had the experience of describing a problem to someone else, perhaps even to someone who has no prior programming knowledge, and then coming up with the answer while doing so. Any discrepancy between what the code is supposed to perform and what it really does can be seen by comparing the two.
In fact, whenever you try to explain or teach a subject, it forces you to evaluate it from more angles and puts everything into perspective. The developer can attempt to complete this without interfering with anyone else by simply explaining to an inanimate item, most commonly in the form of a rubber ducky.
And there's an actual psychological reason behind it, as programmer teacher David Hayes wrote :
"We use ducks and other stand-ins because of the vast difference between the way most humans think and the way that computers do. When you hit a roadblock when programming, it's likely that you're not thinking the way a computer does. Computers are painfully precise. Humans are, generally, forgiving and loose in their understanding. So many of the ‘bugs' and issues you have when solving a problem in your program originate in not being clear and explicit enough in your instructions."
Now, how can you actually use it?
If there's a flaw in your code, but you can't identify what it is, maybe this is the moment when you need a silent friend by your side. Or simply put it — when you get stuck, grab your duck.
Moving forward, this is a simple flow that can help you reach some answers:
- Start with the basics: explain your code and its goals
- Don't skip the details; go through it line by line
- Then move on to all the intermediate states and transitions
- This is the step where your brain starts to unfog and see a possible solution. You're sure to uncover it by going through the procedure, whether it was a typo, the condition, or something else.
Of course, the rubber ducky is just a metaphor for your process of going through the problem from all angles, but it is the most popular go-to item among devs. And who knows, maybe it was a software developer in another life and now has come into this one as your mentor.
Curious to test it out? Email us at team@sensidev.com, and we'll send you our own personalized rubber ducky for free.
Dev Thoughts
![How to migrate a PodBean podcast website to a custom website with Nginx permanent redirects](/_next/image/?url=https%3A%2F%2Fassets.tina.io%2Fac949295-6f4c-48ea-8f33-2f825ae90bf5%2FCover-blog-Dev-Thoughts-ep-11.webp&w=1920&q=75)
How to migrate a PodBean podcast website to a custom website with Nginx permanent redirects
by Lucian Corduneanu • 3 months ago• 13 min read
![The Product Owner’s View Building a Streamlined Transport Management System](/_next/image/?url=https%3A%2F%2Fassets.tina.io%2Fac949295-6f4c-48ea-8f33-2f825ae90bf5%2FCover-blog-Dev-Thoughts-ep-10.webp&w=1920&q=75)
The Product Owner’s View: Building a Streamlined Transport Management System
by Alexandra Voinea • 3 months ago• 5 min read
![Mobile App Development in Action](/_next/image/?url=https%3A%2F%2Fassets.tina.io%2Fac949295-6f4c-48ea-8f33-2f825ae90bf5%2Fimages%2FCover-blog-Dev-Thoughts-ep-9.webp&w=1920&q=75)
Improve Your Dev Journey: Essential Skills Beyond Just Coding
by Dragos Ispas • 3 months ago• 5 min read