DEV Community

Cover image for Don't Pray To The Duck
Steven Stanton
Steven Stanton

Posted on

Don't Pray To The Duck

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

  1. Acquire a rubber duck. (Amazon Has a Great Selection)
  2. Place said rubber duck on the desk in front of you.
  3. Start Coding.
  4. 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.
    1. Here is the important part You must do so out loud.
    2. Remember we are talking to the rubber duck, not praying to the rubber duck.
  5. As you tell your rubber duck all about your problems, you may suddenly realize what the problem was
    1. Remember code is 10 times harder to debug than to write.
    2. Since you wrote the most clever code possible you are by definition not smart enough to debug it.
    3. 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.

Originally published at TheSimpleDev.com

Top comments (0)