Programmer's Motivation for Beginners by Rajaraman Raghuraman - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

 CHAPTER 8– 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 chapter 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 web server

 - 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.

Debugging is often an underrated skill in the world of Software Development. However it is one of the critical skills that we need in order to survive or shine in the software industry.

You may also like...