I think every programmer out there has heard of rubber duck debugging. If you have not heard of it, I will cover the basics here.
I want to share with you some very important advice a co-worker gave to me when I pointed out that talking to him seemed to help more than rubber duck debugging, even though I realized what I was doing wrong while talking to him before he provided me any feedback.
That’s when he introduced me to the concept: Talk to the Duck, Don’t Pray to the Duck.
Something about walking through the problem verbally makes it easier to spot errors.
How to properly utilize a rubber duck Link to heading
- Acquire a rubber duck. (Amazon Has a Great Selection)
- Place said rubber duck on the desk in front of you.
- Start Coding.
- When you reach a bug, explain to your rubber duck what the code is suppose to do, then go into detail and explain your code line by line.
- Here is the important part You must do so out loud.
- Remember we are talking to the rubber duck, not praying to the rubber duck.
- As you tell your rubber duck all about your problems, you may suddenly realize what the problem was
- Remember code is 10 times harder to debug than to write.
- Since you wrote the most clever code possible you are by definition not smart enough to debug it.
- The duck is beaming this information straight into your brain.
Authors Note: It HAS to be a rubber duck. No other type of object will work. I swear a rubber duck is not making me write this.
Remember, respect your rubber duck. The Duck has a PhD.