Why talking to a duck works
Rubber duck debugging comes from The Pragmatic Programmer: explain your code, line by line, to a rubber duck on your desk. The duck never answers. It works because explaining forces you to say the steps you’ve been skipping in your head, and the bug is often in one of them.
This page adds structure. The five questions are the ones a good senior engineer asks when you bring them a bug: what’s the goal, what did you expect, what happened, what have you ruled out, and what’s next. Ending on a concrete experiment turns “I’m stuck” into something you can run.
A worked example
What are you trying to do? Users who reset their password should be able to sign in straight away.
What did you expect? After the reset, signing in with the new password returns 200 and a session cookie.
What actually happened? It returns 401 for about a minute, then works. Only in production, not locally.
What have you tried or ruled out? The new hash is written: I can see it in the database straight away. The password is right, because it works a minute later. Local has one app instance; production has four… and each instance caches user records for 60 seconds.
What will you test next? Reset a test account and sign in against each instance directly. If only the instances that didn’t handle the reset return 401, it’s the per-instance cache, and the fix is to invalidate it on password change.
Illustrative example. Notice the answer arrived while explaining question four, not after it. That’s the usual pattern.
Tips for a useful session
- Say it out loud. Thinking an explanation lets you skip steps. Speaking it doesn’t.
- Read the error exactly. Don’t paraphrase. The detail you summarised away is often the clue.
- Separate “I checked” from “I saw”. If you can’t say how you know something is ruled out, it isn’t.
- Keep the next experiment small. One change, one prediction, a few minutes.