DEV Community

Discussion on: Debugging - you’re doing it wrong. 10 techniques to find a bug in your code

Collapse
 
shamimahossai13 profile image
Shamima Hossain

I have never used a debugger. As for me, I have learnt the most by manually tracing and grinding at the code. Yes it may be inefficient but a lot of the times you don't get an expected output due to some wrong logic. I guess manually analyzing code helps catch those.

Great read btw!

Collapse
 
lishine profile image
Pavel Ravits

Me too, never use debugger, just console.log

Collapse
 
simbo1905 profile image
Simon Massey • Edited

I set up a debugger to step through some open source code that I had volunteered to help out with. I was wanting to add a small feature so wanted to step through to get familiar. On the first step through the code I saw a bug that had been around a while and saw some dead code. I wasn’t looking for bugs but I was reading ahead and stepping and it suddenly did stuff that I mentally said “oh! why? that cannot be right...”.

This particular project is a bash tool to encrypt secrets in git called git-secret. No-one had run a debugger as its bash and folks don’t really thinks about debugging bash with breakpoints. Fortunately visual studio code on mac can integrate with bashdb and you can step through. So i made a video to show others on that project how to use a bashdb with vs code.

Maybe you will see something for the first time if you try stepping through code. Just a thought.