Rubber Duck Debugging
What is it?
Rubber Duck Debugging is a proven technique which can be beneficial in helping you make progress when your code isn't quite working properly.
The concept is simple:
- Grab your rubber duck (you were given one at CoP #1. But if you don't have it with you grab something else - a teddy bear, a lego minifig, your favorite coffee cup. It really doesn't matter).
- Set it down next to you while you are sitting at the computer.
- Explain to the duck that you are having difficulty and your code doesn't work.
- Tell the duck OUR LOUD what the code is supposed to do.
- Step through your code one line at a time and explain OUT LOUD to the duck that line of code.
- What is it supposed to do?
- Why does this step help you in the big picture of the program?
- What kinds of data are you working with?
- The whole idea is that OFTEN in doing this process - in talking outloud to your duck. You hear yourself say something and your brain clicks in and says "that's not right" or "it would do that if I added this" or "wait. that isn't the right command/data"
It may seem silly to talk outloud to a TOY. But this actually DOES work with some regularity. It may feel silly. But if it works, why do we care?
Resources
- VIDEO
- Wikipedia (I mean, if it has a wikipedia page...)
- rubberduckdebugging.com