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

Automating Processes: Steps to Streamline Success 🔧

Automating Processes: Steps to Streamline Success 🔧 In today’s fast-paced business environment, process optimization is crucial for staying competitive and efficient. Here are some essential steps to ensure your processes are as smooth and effective as possible:...

read more

Ever wished you could explain complex ideas in minutes?

Ever wished you could explain complex ideas in minutes? I just tried Loom and I'm blown away. 🎥 With just one click, I can create professional-looking tutorials in a matter of minutes. No fuss, no hassle—just hit record and share instantly. This tool is a game-changer...

read more

The Art of Delegation: Toddler Edition

The Art of Delegation: Toddler Edition For the past two months, I’ve been flying solo at home while my wife is off on a work adventure overseas. It’s just me, our 1-year-old, and our 3-year-old—and let me tell you, delegating has become my superpower. I used to help...

read more