Monday 8 April 2013

The art of debugging

In software, everyone faces issues almost daily.  We need to be highly equipped to solve those issues.  Not all problems are straightforward to find out and require a lot of debugging to be done.  Hence debugging skills is of prime importance.  I would like to reiterate that everything in software development is an art.  Similarly debugging is also an art.  In this post I will focus on how to debug a software problem.

  • Understand the architecture
    • The more the number of components in a system, the more complex it gets to solve an issue.  It is critical to understand the architecture of the software / the module in order to debug a problem.  Suppose your system has a client web browser and at the server side a web server and a database server.  What if this setup is required to be able to work through a VPN connection? And you get an error in your web server mentioning that you "Could not connect to the database server", where do you think the problem might be.  The problem might be anywhere.  Hence it is very important to understand the architecture if you want to solve the problem quickly.
  • Analyze the entire picture
    • Once you get the entire picture, analyze the entire picture and try to see where the symptoms are lying.  I refer symptoms here because whatever you see is only a symptom, we need to trace to the problem in order to solve it.
  • From the symptom, try to trace the problem
    • Many problems tend to have more than one symptom, look out for those and try to get those hints.  In our example, "Could not connect to the database" is a symptom.  The problem might be due to various reasons.
  • Try to list different possibilities
    • Try to list out the different possibilities that might result in the actual symptom.  In our example, the symptom could be due to the following reasons
      • Database server is down
      • Database server is not listening on the expected port
      • Database server is not accessible from the webserver
      • Database server is not accessible through the VPN
      • Database server port is not accessible through VPN
  • Make an educated guess where the problem might be
    • Out of the possibilities, try to make an educated guess where the problem might be and try to dig into the problem.
  • Eliminate component by component
    • If you can't make an educated guess, you need to identify the problem with the help of an elimination round.  Since you have the basic understanding of the architecture, try to eliminate it component by component.  That is how complex problems are solved by breaking them into individual pieces.
Hope this post was useful.  Comments are welcome.  Thanks for reading.


About the Author

Rajaraman Raghuraman has nearly 8 years of experience in the Information Technology industry focusing on Product Development, R&D, Test Data Management and Automation Testing.  He has architected a TDM product from scratch and currently leads the TDM Product Development team in Cognizant.  He is passionate about Agile Methodologies and is a huge fan of Agile Development and Agile Testing.  He blogs at Test Data Management Blog & Agile Blog.  Connect with him on Google+

1 comment: