Debugging is Fun

"If you don't enjoy debugging, you're pretty much not a programmer at all, forget a good one."

Debugging is an art rather than a mere requirement imposed upon you by circumstances. Most of us define debugging as an act of finding and fixing bugs. As soon as you find that your program is misbehaving, you start a debugger and move around the code systematically and try to find out the exact code snippet which could be causing the issue. Once you find the faulty piece of code, you replace it with the correct one and voila !! your job is done !

But debugging is much more useful than just finding bugs. Debugging is the best way of testing your code - yes, it is better and more enjoyable than running hundreds of test cases. Being a developer you know the code best, all the if-else branches, all the places prone to null checks, where all calculation can go wrong, values returned from functions etc. Since you have the actual code at your disposal, you can run that code through a debugger once and see the execution of each and every statement and condition. You can also modify your variables within debugger itself and see how your code behaves with different set of values for the same variable.

Debugging can really be helpful in cases where a particular branch of code can not be reached in normal flow of program and you don't have a test case at present. What if that code piece has some null dereferencing issue? It will never be caught by any tester since there is no test case for it, you will ignore it since you know that it will be a very rare case to hit. The only way to  go ahead is to put up a debugger and manually modify variables and simulate conditions so that debugger reaches that piece of code and then you can see if it will execute properly or not.

Debugging is not only about technical skills, it is more about one's analytical skill. If reflects one's thought process too. This is why most of the interviews involve debugging related questions. It is not to scare anyone or judge one's technical aspect - it is there to see the problem solving attitude of the interviewee. So, it is very important to develop your debugging skills. You will learn it with experience but for starters you can refer to my book - "Hello World: Student to Software Professional " published by Partridge (A Penguin Random House Company). Now available worldwide on all the MAJOR ONLINE Stores - AmazonGoogle Play, Flipkart, Barnes & Noble and many others.

comments powered by Disqus