Rubber Duck Debugging in 100 Seconds
Tags: javascript, webdev, design, architecture
Published: 2021-06-15 07:53:25

## :duck: What is Rubber Duck Debugging?
**Rubber Duck Debugging** refers to debugging your code with the aid of a rubber duck. You describe and explain each step of your code, in detail, to the duck, until you notice the problem that's been causing the unexpected behavior.
![Rubber Duck Debugging 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u1xtlefpylem14itp6co.jpg)

## :bust_in_silhouette: Origination
The name **Rubber Duck Debugging** is a reference to a story in the book *The Pragmatic Programmer* in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck.

![Rubber Duck Debugging 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0y6mf3u9uiwhyzq1xiii.jpg)

## :clipboard: How to apply
The rubber duck debugging method is as follows:
1. Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety).
2. Place rubber duck on desk and inform it you are just going to go over some code with it, if that’s all right.
3. Explain to the duck what your code is supposed to do, and then go into detail and explain your code line by line.
4. At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way.

*(Extracted from [rubberduckdebugging.com](https://rubberduckdebugging.com))*

![Rubber Duck Debugging 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cywy7z0wvjuqrup33dqs.PNG)

## :star: Why Rubber Duck Debugging?
- Help you develop the skill of describing things in simple, clear and concise language.
- Engaging in metacognition: Assessing your understanding of a problem, assessing the strategies you've tried and generating new approaches.
- Force you to make serious attempts at solving the issue yourself before asking for help.

## :older_man: Quotes
- "Insights are often found by simply describing the problem aloud." *(Duck, Quack Overflow)*

## :memo: Side Notes
- Don't have a rubber duck? Any inanimate object will work equally well.
- If you're in a quiet office and don't feel comfortable talking to rubber toys, go out and talk to yourself or writing down your problem can also help.

![Rubber Duck Debugging 4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sa9gq986wu4y055huzl.png)

## :newspaper: Others
Be interested? :smiley: You can visit the links below read my other posts in your next 400 seconds, too :blush:
- [Single Responsibility Principle (SRP) in 100 Seconds](https://dev.to/richardwynn/single-responsibility-principle-srp-in-100-seconds-3b1d)
- [YAGNI Principle in 100 Seconds](https://dev.to/richardwynn/yagni-principle-in-100-seconds-1i6j)
- [KISS Principle in 100 Seconds](https://dev.to/richardwynn/kiss-design-principle-in-100-seconds-3ca6)
- [DRY Principle in 100 Seconds](https://dev.to/richardwynn/dry-principle-in-100-seconds-2l8c)

## :iphone: Keep in Touch
If you like this article, don't forget to follow and stay in touch with my latest ones in the future by following me via:

- **Twitter:** https://twitter.com/RichardWynn01
- **Medium:** https://richard-wynn.medium.com
- **Github:** https://github.com/richard-wynn