This book explores methods for debugging, organized according to six intellectual disciplines:
The way of the detective
The way of the mathematician
The way of the safety expert
The way of the psychologist
The way of the computer scientist
The way of the engineer
Each way has an analogy, a set of assumptions that forms a worldview, and a set of techniques associated with it. We follow a multidisciplinary approach, in which we seek the best methods for solving intellectual problems.
When we follow the way of the detective, we use an analogy between the search for the culprit in a murder mystery and the search for a software defect in a program. The defect is treated as a crime, and the programmer is the detective. A detective who wants to solve a crime must determine the answers to several important questions:
Who did it?
How did the culprit do it?
When did the culprit do it?
Why did the culprit do it?
We seek similar answers for software defects.
When we follow the way of the mathematician, we use an analogy between developing a proof of a mathematical proposition and developing a diagnosis of a software defect in a program. In the past several centuries, mathematicians have developed numerous methods for constructing proofs. These methods, however, have only recently been organized and taught in a way that the average student can learn and apply as effectively as the mathematically gifted.
When we follow the way of the safety expert, we use an analogy between accidents or critical events and failures of software to behave as expected. The defect is considered a critical event, and the programmer is the safety analyst. The safety expert seeks to prevent future problems by analyzing the causes of significant events, such as accidents, near misses, and potential problems.
When we follow the way of the psychologist, we recognize that software defects are the result of human error. Human error has recently become an area of study for cognitive psychologists. The information-processing model used by many psychologists provides a means to explain how humans make mistakes.
When we follow the way of the engineer, we use an analogy between the design of reliable material objects and the design of reliable immaterial software. Engineers follow a standard process for creating physical objects. We can leverage the methods that can prevent or identify defects that are introduced during phases of the software-development process. Engineers design useful objects by following standards, and we suggest ways to prevent software defects by following standards.
When we follow the way of the computer scientist, we treat defective software as processes that fail to manipulate symbols correctly. Computer scientists study symbol manipulation by digital electronics. Some of the theoretical concepts of computer science for classifying and analyzing information can be applied to the process of debugging. Computer scientists advance their discipline by inventing layers of tools that can be composed into larger systems. When we follow the way of the computer scientist, we look for tools that can automatically diagnose software defects.