The Zen of Using a debugger!!!

I never used a debugger when I was doing my bachelors in computer science I always thought this, maybe because I didn’t really know how to use a debugger… Of course the theory behind debugging was taught to me, and we had some practical tests too, but I never really needed it during my graduation, so it became a neglected skill… And now when i have started I realized that I was the exception to the rule, as everyone around me relied heavily on their debuggers….

So what did i do when my programs broke??? I simply used the hit n trial method… Usually when a bug happens it’s a direct consequence of something you changed in the very recent past, so thats what I do… When that doesn’t work, I would either try more guesses or resort to a massive amount of print statements that output debug info while running the program normally… Now looking at this I have learnt alot using a debugger… I think my skill as a programmer and the quality of my code improved after I made this step…

But one thing to note is that its important to know when to use a debugger…

Debuggers are for lazy and sloppy programmers…

Some programmers use the debugger to understand the structure of a code… I can only say why??? As a programmer you should be able to read the code and understand the structure… You should not require a single step through the debugger to understand the flow….

But still i believe that :

Reading the code to find the bug makes you learn the code by heart…