Rubber duckie - you're the one! Why rubber ducks are important in web development
Did you know that there's a connection between web development and those adorable yellow bath toys we all love?
Well now you do!
To celebrate National Rubber Duck Day, we've dove into the origins of the rubber ducking method and how you can use it while troubleshooting your code.
“Rubber duckie you're the one.
You make bath time lots of fun!
Rubber duckie I'm awfully fond of you.”
Back in 1970, Sesame Street introduced the world to the Rubber Duckie song, performed in the bathtub by Ernie (of Bert & Ernie fame).Whilst rubber ducks are known for being beloved by muppets and small children at bath time, you may not be aware that rubber ducks are also important in web development.
The “Rubber ducking” method is used to help debug code or figure out a problem. The original source of the rubber duck method is attributed to the book The Pragmatic Programmer by Andrew Hunt and David Thomas back in 1999, however you don’t have to be a developer to use this method, it’s an approach that’s really useful to everyone.
Getting your ducks all in a row
Developers are problem solvers, but sometimes (because they are human) they can get stumped, and need a hand to figure out a problem.
To explain the rubber ducking method, let's imagine that Ernie is a developer...
Ernie’s code should be working, but something's going wrong, and it’s getting really frustrating. He checks and tests each line trying to figure it out but can’t find a solution. He’s tried all kinds of changes and tests and the answer is eluding him, so he needs some assistance. Ernie goes over to his best friend Bert and tries to explain the problem he’s having - hoping that Bert will help him out.
Unfortunately Bert is really busy and doesn’t have the time to listen to Ernie explain the problem, let alone help fix it. Bert is kinda grumpy and sends Ernie away.
Time to bring in the duck
With no Bert to turn to, Ernie heads over to his other special friend - the rubber duckie.
Out loud, Ernie explains to the duck what the code is supposed to do and the reason for it, then goes into detail line by line. The duck listens patiently as rubber ducks are really good listeners and don’t interrupt. Part way through the explanation Bert stops - the answer has appeared in his mind as if by magic.
Thanks rubber duckie!
He rushes back to his laptop and gets to work fixing the problem.
Did the duck really solve the problem?
Was it telepathy? Did the duck send psychic signals to Ernie to help him solve the problem? Did it shake its plastic tail, wink and cast some magic “quack”? Sadly not.
The key to this method is explaining out loud the situation to another person - or rubber duck. The best part about the duck is they let you talk to them for as long as you need, and through the explanation the brain opens up neural pathways that weren’t open previously, which can lead to insight and revelation.
Showing the rubber duck the steps can also help, as when you walk through a situation (especially on a website) and show someone else you may notice things you overlooked.
Try it out
If you’re ever stuck, why not make a rubber duck your bug hunting partner?
You don’t need to have an actual rubber duck, you can substitute a pet, a photograph, or co-worker as necessary. Sometimes the co-worker can help by prompting questions at key points - but this really depends on the issue and experience of rubber-ducking by the people involved.
However, if you do fancy purchasing your own rubber duck there is a wide range available, including extra small ones that are the perfect size to keep in your desk drawer and bring out when necessary.
And if you need assistance with a tricky web dilemma that a rubber duck just can’t provide, you can get in touch with our web team by submitting an enquiry!
You can also watch the Sesame Street rubber duckie clip here: