Rubber Duck Debugging: What is that?

0
Rubber Duck Debugging

No, seriously. It is what you think it is. A duck and a computer program. You may be wondering why of all things a duck? And what has a duck got to do with computers and debugging software?

What is Rubber Duck Debugging?

In software engineering terms, rubber duck debugging or rubber ducking is a method of debugging code. To put it simply, it is a technique when explaining something to a complete half-wit who knows literally nothing of what you are saying. The name is a reference to an adapt in the book “The Pragmatic Programmer” where a programmer would carry around a rubber duck and debug their code by forcing themselves to explain to the duck line-by-line of their code. Many other terms exist for this technique, often involving different inanimate objects.

How Do I Get Started?

Firstly, get a duck. Not a live one. Get a rubber duck. More of the ones you see in bathtubs.

Secondly, place the duck on your desk or on your laptop. Talk to the duck. Tell it you are just running through some lines of code.

Lastly, explain to the duck what your code is supposed to do and then explain your code in detail line by line to the duck.

Bonus: substituting your co-worker for the duck. Will work either ways.

This will make me sound like a complete nut-case! Is there another way out other than talking to a duck?

Yes, it is easier said than done. Talking to a duck, let alone explaining the logic of coding to a duck takes lots of courage and some sanity. You can substitute the duck for your co-worker. Talking to your co-worker should make you feel less awkward.

Does This Solve The Horrors Of My Coding And Other Works?

Strangely, yes. This helps you in your coding. Here’s why it works: coding is like doing mathematics, except for some parts where you are actually thinking about it. If you can’t figure it out, chances are you are not thinking about the part where the actual problem exists.

But, here’s the thing. When you have to explain the problem to another developer or the duck, you can’t explain half the problem but the WHOLE problem and the parts related to the problem. For example, you have to provide the full picture of the problem you are trying to solve. When you do this, even with a rubber duck, chances will be you will stumble upon the part where the actual issue is or even a new approach and solution to the problem


IoTalents.com is an integrated platform for online Hirers and IT Workforce (Employees, Contract workers and Virtual Talents) to get intelligently connected and transact. We match companies to awesome talent, through a precise combination of data science and human judgement.