rub·ber duck de·bug·ging
/ˈrʌb.ər ˌdʌk diːˈbʌɡ.ɪŋ/ (RUB-er duk dee-BUG-ing) noun
- Explaining a problem line by line to an inanimate listener, which often reveals the bug before the explanation is finished. Halfway through describing the loop to a rubber duck, she noticed the index never reset.
Origin
From The Pragmatic Programmer by Andrew Hunt and David Thomas (1999), in which a programmer explains code to a rubber duck.
In practice
An AI assistant makes a good duck, provided you do the explaining. Writing out what the code should do, step by step, finds the gap.
Say to your AI
Don't fix anything yet. I'm going to explain what this function should do; stop me at the first step where the code doesn't match.
In plain words
- explaining the problem out loud helps me solve it
- I figured it out while writing the question
- talk it through
- explain it to someone who doesn't know
See also heisenbug shotgun debugging chain of thought