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

Progressive Enhancement for JS is overrated.

Progressive Enhancement for JS is overrated. In today’s web, HTML + CSS + JS is a package deal. Almost every browser supports the trio, and let’s be real: users expect apps to work smoothly with JavaScript. 95%+ of users have JS enabled – why build for the exception?...

read more

Alpine.js just clicked. 🎯

Alpine.js just clicked. 🎯 Its declarative syntax—attributes on HTML tags—is perfect for simple UI logic. Most of the time, I don’t even need to touch JavaScript. And when I do? I can write just a little bit, and it fits right in. What’s even better? The declarative...

read more

HTMX + ASPNET Core Razor = magic. ✨

HTMX + ASPNET Core Razor = magic. ✨ But HyperScript? Not so much. 😅 As a developer, I gave HyperScript a try for client-side interactions. I really wanted to love it—especially since it’s from the same creator as HTMX. But every time I used it, I spent way too much...

read more