DEV Community

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

Posted on

3 2 2

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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay