The Art of Computer Software Debugging
A large percentage of all software engineers maintain programs. They have to routinely deal with poorly written programs that are bloated and twisted out of shape over years of maintenance, absence of any documentation and even worse, misleading documentation.
While most engineers do a good job of maintaining software, there is always a minority that excel at maintaining software developed by others ! There appears to be a silent process at work, when such an engineer looks at a defect description and starts to identify what is wrong with the system. A clear understanding of this process will certainly make it easier to break down the debugging process into a sequence of well defined steps.
What is Debugging ?
Debugging (in the context of software engineering) refers to the process of identifying the cause for defective behavior of a system and addressing that problem. In less complex terms - fixing a bug. A significant percentage of all the time spent on maintenance is often spent on debugging activities.
Life Cycle of a Debugging Task
Let us assume that a defect has been identified in a software system, here are roughly the various steps involved in debugging:
a) Defect Identification/Confirmation
b) Defect Analysis
Assuming that the software engineer concludes that the defect is genuine, the focus shifts to understanding the root cause of the problem. This is often the most challenging step in any debugging task, particularly when the software engineer is debugging complex software.
Many engineers debug by starting a debugging tool, generally a debugger and try to understand the root cause of the problem by following the execution of the program step-by-step. This approach may eventually yield success. However, in many situations, takes too much time, and in some cases is not feasible, either due to the complex nature of the program(s).
c) Defect Resolution
Once the root cause of a problem is identified, the defect can then be resolved by making an appropriate change to the system, which fixes the root cause. [we will revisit this in the future]
Defect Analysis Revisited
Let us now define a few terms more formally:
It now becomes clear that defect analysis basically consists of root cause analysis.
[We will discuss defect analysis in more detail in