I almost never Debug my code.

by Apr 30, 2024

I almost never Debug my code.

Somehow this is strange in the eyes of fellow developers. They can’t image coding without a debugger.

For example, I have never felt the need to attach a debugger to a deployed Dynamics 365 Plugin. Never!

Ok, one time. I wanted to know how to debug remotely into a Dynamics 365 environment.

I see some developers hooked on debuggers; they have a tough time coding without it.

How do I do it? Four ways:

1️⃣ Deducing

I can pretty well deduce how code works, just by looking at it and reasoning about it.

I even started programming using pen and paper, before I even had a PC. I was eagerly saving money to buy one.

2️⃣ Defensive programming

Always validate inputs into your code. Handle them by having good defaults or throw an exception with a good description of the issue.

When a bug occurs, the exception is so descriptive that I don’t need to debug to fix the issue.

3️⃣ Testing

For things that are harder to deduce or are more complex, I create tests. I test what I think should happen and verify this.

Test all the possible scenarios that you can think of.

3️⃣ Logging

I log extensively. My assumption when doing logging, is that I am not allowed to have access to the server or the machine of the user.

I often log at places where a clear next step in my code happens. Usually, the place where you would place a breakpont for the debugger.

I log as much useful information as possible so, assuming that I am not allowed to start a debug session.

When a bug happens, the logs tell me a lot about the location of the issue and how to solve it.

Often the Logging section on my Azure bill is the biggest part of a solution.

And yes, sometimes I also use a debugger, when the above ways all failed to help me out, but it doesn’t happen often.

Are you addicted to your debugger?

Remy van Duijkeren

Remy van Duijkeren

Power Platform Advisor

Microsoft Power Platform Advisor with over 25 years of experience in IT with a focus on (marketing) automation and integration.

Helping organizations with scaling their business by automating processes on the Power Platform (Dynamics 365).

Expert in Power Platform, Dynamics 365 (Marketing & Sales) and Azure Integration Services. Giving advice and strategy consultancy.

Services:
– Strategy and tactics advise
– Automating and integrating

Subscribe to
The Daily Friction

A daily newsletter on automation and eliminating friction

Related Content

ReSharper is 20 years old! 🎉

ReSharper is 20 years old! 🎉 Reading https://blog.jetbrains.com/dotnet/2024/07/23/resharper-20-years/ makes me realize how long I have been a .NET developer. I still remember using ReSharper for the first time. 💡 ReSharper made Visual Studio a much better IDE. 🚀 It...

read more

Switching from Google to Bing 🔍

Switching from Google to Bing 🔍 Recently, I've decided to switch from Google Search to Microsoft Bing, and here’s why: Ad Overload on Google: Google's integration of its advertising and search teams has led to a surge in sponsored links. This trend often means...

read more

Improving Optimization?

Improving Optimization? The traditional steps of Optimization: 1. Eliminate 2. Automate or 3. Delegate What if we added a missing element? Simplify. Before automating a convoluted workflow or delegating a tangled task, strip away the unnecessary. Make processes leaner...

read more