DEV Community

Olufisayo Bamidele
Olufisayo Bamidele

Posted on

4 approaches to debugging that is less talked about.

1. Commenting out the suspected block of code Some blocks of code are more innocent than others.

Sometimes, where you're looking at is not where the problem is. This is particularly useful when you don't even understand the problem yet. It has saved me a lot of times

2. Talking to yourself/Explaining the problem to others

Who talks to themselves the most? Programmers. We always do it but most of us don't do it out loud. It turns out that doing it out loud can be more effective. It's like pair programming with yourself.

3. Take a walk

This is counterintuitive. Not even related to the problem at all but it turns out to work most of the time. When we spend very long hours in front of our systems, it often seems like our vision becomes narrowed. Just like a painter would step back from the canvas to see the result of her brush strokes and move closer to make corrections, it is important to step back from our work for few hours especially when we are not making progress. Some solutions come to us when we are not thinking about the problem.

4. Sleeping

I can't explain this but I remember a few times when I dreamt of a solution, got up from bed in the middle of the night, and fixed a problem. I have also heard similar experiences from other programmers so it seems this is not just my thing.

Have you personally tried any of these methods? What other unconventional approach do you use?

Top comments (0)