Are you Into Rubber Duck Debugging?
Anita Olsen

Anita Olsen @anitaolsen

About: Greetings! I am a retired hard of hearing hobbyist coder 😊 I am into learning new things, finance, reading, writing and playing video games.

Location:
Norway
Joined:
Oct 27, 2023

Are you Into Rubber Duck Debugging?

Publish Date: Apr 23 '24
32 31

Rubber duck debugging refers to debugging your code with the aid of a rubber duck. You explain each step of your code to the duck until you notice the problem that has been causing the unexpected behaviour. Rubber duck debugging was first coined in the book, The Pragmatic Programmer, by Andrew Hunt and David Thomas.

Are you into rubber duck debugging?

Comments 31 total

  • Steeve
    SteeveApr 23, 2024

    I often ask my colleagues to be the Rubber Duck (yes that's strange to say that), it's easier to talk to humans for debugging even if they don't have the full context or technical knowlegde:

    • First I'm the only one to talk, to make a quick recap of the situation
    • Then they ask (dum) questions :D

    And it's working most of the time!

    • Anita Olsen
      Anita OlsenApr 23, 2024

      This is an excellent idea and I believe it is the best one because then you get input :D

    • Mike Talbot ⭐
      Mike Talbot ⭐Apr 26, 2024

      My team have 3 sessions a week in the diary for this kind of debugging, of course it also happens at other times too!

  • Ranjan Dailata
    Ranjan DailataApr 23, 2024

    The majority of the problems which I have solved is based on the inspiration of "Inception" movie. The more time diving into the code, living with it and spending time by in-depth analysis has lead to solving crucial problems.

    • Anita Olsen
      Anita OlsenApr 23, 2024

      I love that film, it is so deep!

  • Paulo Henrique
    Paulo HenriqueApr 23, 2024

    I prefer penguin debugging

    Image description

    • Anita Olsen
      Anita OlsenApr 23, 2024

      Aw, cute penguin. Cool glasses 😎

    • cubiclesocial
      cubiclesocialApr 24, 2024

      I know it's not a competition but for fun I'll raise you 300% clout and a tropical beverage:

      Image description

      • Paulo Henrique
        Paulo HenriqueApr 24, 2024

        OH, YOU WANNA COMPETE? (I hope not, I don't have too many photos of Godofredo)

        Image description

        • cubiclesocial
          cubiclesocialApr 24, 2024

          I have many more penguins but I hesitate to produce them:

      • Anita Olsen
        Anita OlsenApr 25, 2024

        That is one awesome penguin as well 😊

  • Ben Link
    Ben LinkApr 23, 2024

    Yes, there's a fairly simple explanation for it, too - if you're only thinking (not speaking), you process about 1200 words / minute.... but if you talk, you slow down significantly (even fast talkers sustain at around 300).

    The reason that the duck works is because when you slow down to explain it, you actually get a chance to think harder about what you're saying, and the answer usually bubbles right up!

  • Oscar
    OscarApr 23, 2024

    Instead of talking to a rubber duck, I normally just talk to myself or the wall. I'm pretty sure that my family thinks I've finally lost it xD.

    • Anita Olsen
      Anita OlsenApr 23, 2024

      Haha, I talk to myself as well xD

  • Ben Halpern
    Ben HalpernApr 23, 2024

    It almost always works 😄

  • Marissa B
    Marissa BApr 23, 2024

    Yes, I have a large rubber duck in my office for this reason. Sometimes my wife nods along and acts as the duck instead.

    When I was in college I would use our pet bulldogs, but they were more interested in my snacks haha.

  • Mr. Linxed
    Mr. LinxedApr 23, 2024

    I usually try to explain the issue in my head to someone else, before actually explaining it to them. 90% of the time it solves the issue before bothering them

    I guess that is a form of rubber duck debugging?

    • Anita Olsen
      Anita OlsenApr 23, 2024

      I truly believe it is! I am yet to use a rubber duck myself.

  • Monty Harper
    Monty HarperApr 23, 2024

    I am the duck.

  • Cipi
    CipiApr 23, 2024

    have to admit that i would have to "rubber duck" more often. What helps me most is to physically take a step back from the problem, two to three hours, and then slowly roll up the problem again ... it often helps me to build up distance, to talk to other people about something completely different, to move around and suddenly an approach comes over me. In fact, i am then completely back to the task at hand and motivated to find a solution

  • Christophe Colombier
    Christophe ColombierApr 24, 2024

    It's a great technique.

    You often find solution by stepping out, and explaining the problem out loud.

    It happens when I explain my current issue/doubts about an implementation or refactoring. Most the time, they will give you feedbacks about your issue, but sometimes you will be the one suggesting the solution. The discussion generally ends by a "thanks for being my rubber duck today"

    My wife knows and likes this concept, so she bought me a real one this last year:

    Image description

    Image description

    Here is a Wikipedia article if you want to go further

    In software engineering, rubber duck debugging is a method of debugging code by articulating a problem in spoken or written natural language. The name 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. Many other terms exist for this technique, often involving different (usually) inanimate objects, or pets such as a dog or a cat. Teddy bears are also widely used. When humans are involved, it is known as confessional programming.

    • Anita Olsen
      Anita OlsenApr 25, 2024

      You are absolutely correct! Whenever we encounter a problem which we struggle with, it can more often than not be most helpful to get out of our heads and say it out loud. Strange how that works but it does!

      PS! Awesome pictures :)

  • Salika Dave
    Salika DaveApr 24, 2024

    I've been the duck, almost always. 😂 But reading this post gave me this idea I would like to test out, could we make use of GPT and improve rubber duck debugging?
    Here's a prototype for Rubber Ducker @ coze.com/s/ZmFquWNtX/

  • Qyrus
    QyrusApr 26, 2024

    This is the best way to debug! Verbally processing with colleagues is fun, collaborative, and honestly makes debugging way less painful😂

  • gokayburuc.dev
    gokayburuc.devApr 29, 2024

    Here is the deal. Imaginary partner syndrome. Line by line describe your code to find mistake.When i am coding, sometimes talk to a bad character like Davy Jones (a cruel sly pirate) is much more efficient than the rubber duck. Rubber duck is adorable funny pal but the customers, no sir!
    Davy-Jones

  • kerkg
    kerkgMay 1, 2024

    no python made me go crazy and now Im the rubber duck

  • Besworks
    BesworksApr 30, 2025

    I used to do this to my wife all the time. She never had a clue what I was going on about but just talking through the issue almost always led to the answer. These days I bother copilot instead of her. She's happier, and I automatically keep a log of my thought process that I can reference in the future. Quite often, I either work out the solution as I'm explaining the problem or at least discover the root cause. And as a bonus, copilot often has useful notes on the topic instead of just a blank stare.

Add comment