Why you need a duck.

My rubber duck To all those new to tech, let me tell you why you need a rubber duck and why the ‘rubber ducking’ technique will serve you well as you navigate learning code and push your career forward.

What is Rubber Ducking? The name “rubber ducking” comes from a story about a coder in the book 'The Pragmatic Programmer' where the main character would go through his code to a rubber duck on his desk.

So why is it such an effective technique? He would explain his code, line by line, to the inanimate object, helping him catch mistakes and solve problems. The verbalisation of the code forced him to think more critically about each step and identify potential errors or bugs. He was forced to think through each step and consider how it fits into the larger picture. This technique can help you catch errors or logical inconsistencies otherwise missed if you tried to do it all in your head.

Benefits: It encourages you to take a step back: Sometimes, when you are deep in code, it's hard to see the woods from the trees, ‘Rubber ducking’ forces you to take a step back and take a new look at your code.

It’s a low-pressure way to debug: When working on a complex project, it’s easy to get overwhelmed by the sheer scale of a project, the number of bugs and the issues that need to be fixed. ‘Rubber ducking’ provides a less stressful way to work through these problems one at a time.

Bringing more whimsy into your day: It may make you feel a little silly telling your coding woes to something so damn cute at first but the interjection of ‘out of the expected’ removes some of the pressure and helps to add some perspective to a very stressful and overwhelming situation.

Of course, rubber ducks may not be your thing, and for that reason, I have come up with a list of my favourite alternatives:

Slack Coworkers A baby Yoda. A photo of Albert Einstein. Your pet. Stack Overflow

In conclusion, rubber ducking is a simple but effective technique that can help junior developers debug their code more effectively. By explaining your code out loud and taking it step by step you can catch errors and identify problems easily, while also taking a step back to thinking critically about your work.

Avatar for Laura Mayock

Written by Laura Mayock


Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.