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

Backlog: The Black Hole of ideas

Backlog: The Black Hole of ideas Is your backlog turning into an ever-expanding universe of forgotten dreams? We all know that mix—a jumble of big ideas and tiny tasks waiting for their day in the sun. Some items linger for years. Why do backlogs grow? Because we...

read more

The Trade-off Between Budgets and Quality ⚖️

The Trade-off Between Budgets and Quality ⚖️ In my previous post, I talked about shifting from Estimates to Budgets for feature development 💡. Let's dive deeper. Using a Budget instead of an Estimate introduces a trade-off: Scope and Quality adjust to fit the time...

read more

Budgets instead of Estimates

Budgets instead of Estimates Estimating a feature is difficult and is often a guess (or even a lie). An Estimate is for a fixed scope. So, you need to think deeply how to implement the feature, before giving an Estimate. The business can then use the Estimate to...

read more