Talking out code…with a duck.
Rubber Ducking is a term coined by Andrew Hunt and David Thomas in their book The Pragmatic Programmer. It refers to a process in which a developer talks through their code out loud line by line in order to uncover a bug. Much like therapy, speaking aloud to someone — or in this case, something — can help you discover issues that were unapparent while trapped in your own head.
Here’s why it works so well:
Taking a step back — In order to explain something to an outsider, you have to take a step back and structure your understanding in more depth than if you go over it internally. You also have to properly identify your questions and clearly state them aloud.
Silent encouragement — In the case that you have access to a a live person, their silence allows your thoughts to continue uninterrupted and signs of encouragement, such as nodding, is helpful in moving the thinking process along.
Arriving at a conclusion — Having a silent listener, whether human or inanimate, allows you to arrive at solutions yourself, which helps with memory retention.
Although it is ideal to grab a live person to act as your Rubber Duck, sometimes it is not always possible. Some programmers keep an actual duck or toy on their desk, while resources such as Rubber Duck Debugging and Duckie are useful on a whim.
Rubber Ducking may be a programming term, but it is a technique widely applicable. So, if you’re stuck, in website code — in a line of poetry, or in life — grab a buddy and talk it out.
Taking a step back — In order to explain something to an outsider, you have to take a step back and structure your understanding in more depth than if you go over it internally. You also have to properly identify your questions and clearly state them aloud.
Silent encouragement — In the case that you have access to a a live person, their silence allows your thoughts to continue uninterrupted and signs of encouragement, such as nodding, is helpful in moving the thinking process along.
Arriving at a conclusion — Having a silent listener, whether human or inanimate, allows you to arrive at solutions yourself, which helps with memory retention.
Although it is ideal to grab a live person to act as your Rubber Duck, sometimes it is not always possible. Some programmers keep an actual duck or toy on their desk, while resources such as Rubber Duck Debugging and Duckie are useful on a whim.
Rubber Ducking may be a programming term, but it is a technique widely applicable. So, if you’re stuck, in website code — in a line of poetry, or in life — grab a buddy and talk it out.