The most dangerous error is failure to recognize our own tendency to error.
—B. H. Liddell Hart
This chapter views finding defects from the perspective of cognitive psychology. The first section explains the worldview of the psychologist. It suggests that psychology is about modeling human behavior and that the mindset of the psychologist can be applied to the process of preventing and detecting bugs.
The second section of this chapter summarizes the approach of cognitive psychologists to the issues of how humans make errors. It begins with common distinctions between errors occurring during the cognitive stages of planning, storage, and execution. It then explains more sophisticated models, which distinguish errors as skill-based, rule-based, and knowledge-based.
The third section of this chapter reviews experimental research on programmers doing debugging. It presents the published research in terms of experiment subjects, programming language used, program size, defect type, experimental procedures, and conclusions.