Skip to main content

Rubber Duck Debugging

If Wikipedia knows it, it’s official; Rubber Duck Debugging is a new tool in my developer toolset!

I first heard about this technique here: http://www.codinghorror.com/blog/2012/03/rubber-duck-problem-solving.html.

An extract from the original story:

Bob pointed into a corner of the office. "Over there," he said, "is a duck. I want you to ask that duck your question."

I looked at the duck. It was, in fact, stuffed, and very dead. Even if it had not been dead, it probably would not have been a good source of design information. I looked at Bob. Bob was dead serious. He was also my superior, and I wanted to keep my job.

I awkwardly went to stand next to the duck and bent my head, as if in prayer, to commune with this duck. "What," Bob demanded, "are you doing?"

"I'm asking my question of the duck," I said.

One of Bob's superintendants was in his office. He was grinning like a bastard around his toothpick. "Andy," he said, "I don't want you to pray to the duck. I want you to ask the duck your question."

I licked my lips. "Out loud?" I said.

"Out loud," Bob said firmly.

I cleared my throat. "Duck," I began.

"Its name is Bob Junior," Bob's superintendant supplied. I shot him a dirty look.

"Duck," I continued, "I want to know, when you use a clevis hanger, what keeps the sprinkler pipe from jumping out of the clevis when the head discharges, causing the pipe to..."

In the middle of asking the duck my question, the answer hit me. The clevis hanger is suspended from the structure above by a length of all-thread rod. If the pipe-fitter cuts the all-thread rod such that it butts up against the top of the pipe, it essentially will hold the pipe in the hanger and keep it from bucking.

I turned to look at Bob. Bob was nodding. "You know, don't you," he said.

"You run the all-thread rod to the top of the pipe," I said.

"That's right," said Bob. "Next time you have a question, I want you to come in here and ask the duck, not me. Ask it out loud. If you still don't know the answer, then you can ask me."

"Okay," I said, and got back to work.

I do think it’s useful for the same reason I like buddy reviews and teaching concepts to others. By explaining a problem to someone else, you get new insights, learn new stuff and discover things you forgot.

Next time you see me talking to a rubber duck, don’t think I’m crazy. I’m just debugging my code… Glimlach

Popular posts from this blog

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Color B

Debug your .NET 8 code more efficiently

.NET 8 introduces a lot of debugging improvements. If you take a look for example at the HttpContext , you see that you get a much better debug summary than in .NET 7: .NET 7: .NET 8: But that is not a feature I want to bring under your attention. After recently updating my Visual Studio version, I noticed the following announcement among the list of new Visual Studio features: That is great news! This means that you can debug your .NET 8 applications without a big performance impact on the rest of your code. The only thing we need to do is to disable the Just My Code option in Visual Studio: If we now try to debug a referenced release binary, only the relevant parts are decompiled without impacting the other code: More information Debugging Enhancements in .NET 8 - .NET Blog (microsoft.com)