If builders built
buildings the way programmers wrote programs, the first woodpecker that came along would destroy civilization.—Gerald Weinberg
I don’t believe that the story of a moth found in a relay of one of the first digital computers adequately explains why software defects are commonly referred to as
The word “bug” is commonly used to refer both to
Software bugs afflict people in very similar ways. Like natural bugs, they’re everywhere. Almost all interesting software has bugs, and most interesting software has far too many bugs. Like natural bugs, they cause irritation and even pain when we encounter them. Now that computer chips are embedded in so many devices, software bugs can threaten human life and property. Calling software defects “bugs” resonates with us at a deep level. This is because software defects are becoming as
There are many reasons why today’s software has so many defects. One reason is that many programmers aren’t very good at debugging. Some programmers look on the debugging phase of the software life cycle with the same
The purpose of this book is to reduce the effort programmers expend to diagnose software bugs. If the time available to debug remains constant in a project, this efficiency improvement will reduce the total number of bugs in a software program. If the number of outstanding bugs remains constant in a project, this efficiency improvement will reduce the time it takes to deliver that software. Either way, the person who benefits is the ultimate
It’s important to use a consistent set of terms when
We will use the term defect to mean that aspect of the design or implementation that will result in a symptom. The IEEE94 Software Engineering Standards refer to this as a fault . We will use the term bug interchangeably with defect.
This book explores
The way of the detective
The way of the
The way of the safety expert
The way of the
The way of the computer scientist
The way of the engineer
Each way has an analogy, a set of assumptions that forms a
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
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
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
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
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