DEV Community

loading...
Cover image for Rubber Duck Debugging as a Learning Methodology

Rubber Duck Debugging as a Learning Methodology

Thiago Monteiro
Building GitDuck
Updated on ・2 min read

Rubber Duck Debugging was created to find bugs in software, but I think it's something else much more powerful. The traditional approach is that you programmed something that contains a bug that you can't identify. The methodology says that you should debug your code by reviewing it piece by piece and explaining it to a rubber duck. By going into those details, the programmer is forced to think clearly and the problems in the code arises.

If you haven't done it, it's quite simple:

  1. Pick your rubber duck (physical or virtual).
  2. Explain your goals and the strategy to accomplish your task.
  3. Go through your code and explain each line and what's happening there.

By doing this process, you are able to spot the bug and fix it.

Rubber Duck Debugging as a learning methodology

Rubber duck debugging works great for developers because it's based on a powerful learning technique: Learning by teaching. This technique has been used since early 19th century and was developed in the 80s by Jean-Pol Martin. The method consists of having students teaching other students. The teaching students should prepare presentations on the topic and by doing it, they were learning faster and more effectively.

Going back to the use cases for developers, instead of using only for debugging. The technique can be used to learn a programming language or simply to learn how something programmed by other developer works. The process is the same as when you are trying to find the bug:

  1. Describe the goals and how the task should be performed.
  2. Explain the code line-by-line.

If you are not able to explain it, very likely you didn't understand it yet and should do a step back and try again. If you can explain everything, great! Now you fully understand it and very likely also had ideas on how to improve it.

How rubber duck debugging technique can be used in other contexts

Just like with software, you can try to teach someone (or a rubber duck) about any subject. In the process, you will gain clarity and learn about the topic faster than if you have just read about it. It will force you to think clearly and more importantly, to express yourself in a simple and clear way.

Research about the topic you would like to teach and prepare a presentation. Doesn't matter if you fail in the first try, iteration is the key. By the time you are able to explain the concept in a concise way, you are going to have mastered it. And it's time to move to the next subject.

Discussion (0)