Why You Should Rubber Duck Debug to Solve Mistakes in Code or Other Work

0
177

It’s uncommon we get the opportunity to sit down and have a calm conversation with a rubber duck. However, in software engineering, rubber ducking is a simple, quick fix to this conundrum! Commonly used to debug code, this practice is an effective method to identify mistakes in a methodological manner. However, rubber ducking is useful outside of computing for working through general issues step by step.

How to Rubber Duck for Rubber Ducking

  1. Firstly, acquire a rubber duck (by any means necessary)
  2. Second, from start to finish, talk to your silent friend line, explaining your code line by line
    • (Go in depth so your duck pal can understand)
  3. Third, hopefully find a solution or at least one of your mistakes!

Why Rubber Duck

You’re forced to vocalize your thoughts. If you have an idea that sounds good in your mind, but not aloud, this is the time to catch it. By rubber ducking, you mention how you want your code to run, and you’ll eventually find where you’re missing that code. 

If you don’t have a rubber duck, you can substitute it for another inanimate object, a friend, or a disgruntled stranger. I carry around a small octopus plush in my backpack as my honorary portable duck. 

Rubber Ducking Outside of Computing

Let’s say you don’t code, but you still want to rubber duck. If you run into a mistake in math, chemistry or physics, you can go step by step through your problem. Many equations in these fields have a distinct procedure (at least at the high-school level). The procedure forces you to explain in layman terms. Therefore, you’ll realize if you don’t understand a concept or see any discrepancies between the formula and your work. Then, if you don’t fully understand a concept in depth such that you cannot explain it simply, you can go study it further.

I sometimes also use rubber ducking for my untimed essays to remove unnecessary lines or ensure that my writing makes sense.

If you don’t want to rubber duck, you should get a rubber duck anyways. From there, you’ll always have a friend. 

 

Image Links:

Feature Image: 1

Images: 1/2/3