Why Programs Fail

Why Programs Fail

A Guide to Systematic Debugging

2nd Edition - June 12, 2009

Write a review

  • Author: Andreas Zeller
  • eBook ISBN: 9780080923000
  • Paperback ISBN: 9780123745156

Purchase options

Purchase options
DRM-free (Mobi, PDF, EPub)
Sales tax will be calculated at check-out

Institutional Subscription

Free Global Shipping
No minimum order


Why Programs Fail: A Guide to Systematic Debugging is proof that debugging has graduated from a black art to a systematic discipline. It demystifies one of the toughest aspects of software programming, showing clearly how to discover what caused software failures, and fix them with minimal muss and fuss. The fully updated second edition includes 100+ pages of new material, including new chapters on Verifying Code, Predicting Erors, and Preventing Errors. Cutting-edge tools such as FindBUGS and AGITAR are explained, techniques from integrated environments like Jazz.net are highlighted, and all-new demos with ESC/Java and Spec#, Eclipse and Mozilla are included. This complete and pragmatic overview of debugging is authored by Andreas Zeller, the talented researcher who developed the GNU Data Display Debugger(DDD), a tool that over 250,000 professionals use to visualize the data structures of programs while they are running. Unlike other books on debugging, Zeller's text is product agnostic, appropriate for all programming languages and skill levels. The book explains best practices ranging from systematically tracking error reports, to observing symptoms, reproducing errors, and correcting defects. It covers a wide range of tools and techniques from hands-on observation to fully automated diagnoses, and also explores the author's innovative techniques for isolating minimal input to reproduce an error and for tracking cause and effect through a program. It even includes instructions on how to create automated debugging tools. The text includes exercises and extensive references for further study, and a companion website with source code for all examples and additional debugging resources is available.

Key Features

  • The new edition of this award-winning productivity-booster is for any developer who has ever been frustrated by elusive bugs
  • Brand new chapters demonstrate cutting-edge debugging techniques and tools, enabling readers to put the latest time-saving developments to work for them
  • Learn by doing. New exercises and detailed examples focus on emerging tools, languages and environments, including AGITAR, FindBUGS, Python and Eclipse


Computer programmers, software developers, analysts and testers

Table of Contents

  • 1 How Failures Come to Be
    1.1 My Program Does Not Work!
    1.2 From Defects to Failures
    1.3 Lost in Time and Space
    1.4 From Failures to Fixes
    1.5 Automated Debugging Techniques
    1.6 Bugs, Faults, or Defects?
    1.7 Concepts
    1.8 Tools
    1.9 Further Reading
    1.10 Exercises

    2 Tracking Problems
    2.1 Oh! All These Problems
    2.2 Reporting Problems
    2.3 Managing Problems
    2.4 Classifying Problems
    2.5 Processing Problems
    2.6 Managing Problem Tracking
    2.7 Requirements as Problems
    2.8 Managing Duplicates
    2.9 Relating Problems and Fixes
    2.10 Relating Problems and Tests
    2.11 Concepts
    2.12 Tools
    2.13 Further Reading
    2.14 Exercises

    3 Making Programs Fail
    3.1 Testing for Debugging
    3.2 Controlling the Program
    3.3 Testing at the Presentation Layer
    3.4 Testing at the Functionality Layer
    3.5 Testing at the Unit Layer
    3.6 Isolating Units
    3.7 Designing for Debugging 7
    3.8 Preventing Unknown Problems
    3.9 Concepts
    3.10 Tools
    3.11 Further Reading
    3.12 Exercises

    4 Reproducing Problems
    4.1 The First Task in Debugging
    4.2 Reproducing the Problem Environment
    4.3 Reproducing Program Execution
    4.4 Reproducing System Interaction
    4.5 Focusing on Units
    4.6 Concepts
    4.7 Tools
    4.8 Further Reading
    4.9 Exercises

    5 Simplifying Problems
    5.1 Simplifying the Problem
    5.2 The Gecko BugAThon
    5.3 Manual Simplification
    5.4 Automatic Simplification
    5.5 A Simplification Algorithm
    5.6 Simplifying User Interaction
    5.7 Random Input Simplified
    5.8 Simplifying Faster
    5.9 Concepts
    5.10 Tools
    5.11 Further Reading
    5.12 Exercises

    6 Scientific Debugging
    6.1 How to Become a Debugging Guru
    6.2 The Scientific Method
    6.3 Applying the Scientific Method
    6.4 Explicit Debugging
    6.5 Keeping a Logbook
    6.6 Debugging Quick-and-Dirty
    6.7 Algorithmic Debugging
    6.8 Deriving a Hypothesis
    6.9 Reasoning About Programs
    6.10 Concepts
    6.11 Further Reading
    6.12 Exercises

    7 Deducing Errors
    7.1 Isolating Value Origins
    7.2 Understanding Control Flow
    7.3 Tracking Dependences
    7.4 Slicing Programs
    7.5 Deducing Code Smells
    7.6 Limits of Static Analysis
    7.7 Concepts
    7.8 Tools
    7.9 Further Reading
    7.10 Exercises

    8 Observing Facts
    8.1 Observing State
    8.2 Logging Execution
    8.3 Using Debuggers
    8.4 Querying Events
    8.5 Visualizing State
    8.6 Concepts
    8.7 Tools
    8.8 Further Reading
    8.9 Exercises

    9 Tracking Origins
    9.1 Reasoning Backwards
    9.2 Exploring Execution History
    9.3 Dynamic Slicing
    9.4 Leveraging Origins
    9.5 Tracking Down Infections
    9.6 Concepts
    9.7 Tools
    9.8 Further Reading
    9.9 Exercises

    10 Asserting Expectations
    10.1 Automating Observation
    10.2 Basic Assertions
    10.3 Asserting Invariants
    10.4 Asserting Correctness
    10.5 Assertions as Specifications
    10.6 From Assertions to Verification
    10.7 Reference Runs
    10.8 System Assertions
    10.9 Checking Production Code
    10.10 Concepts
    10.11 Tools
    10.12 Further Reading
    10.13 Exercises

    11 Detecting Anomalies
    11.1 Capturing Normal Behavior
    11.2 Comparing Coverage
    11.3 Statistical Debugging
    11.4 Collecting Data in the Field
    11.5 Dynamic Invariants
    11.6 Invariants on the Fly
    11.7 From Anomalies to Defects
    11.8 Concepts
    11.9 Tools
    11.10 Further Reading
    11.11 Exercises

    12 Causes and Effects
    12.1 Causes and Alternate Worlds
    12.2 Verifying Causes
    12.3 Causality in Practice
    12.4 Finding Actual Causes
    12.5 Narrowing Down Causes
    12.6 A Narrowing Example
    12.7 The Common Context
    12.8 Causes in Debugging
    12.9 Concepts
    12.10 Further Reading
    12.11 Exercises

    13 Isolating Failure Causes
    13.1 Isolating Causes Automatically
    13.2 Isolating versus Simplifying
    13.3 An Isolation Algorithm
    13.4 Implementing Isolation
    13.5 Isolating Failure-inducing Input
    13.6 Isolating Failure-inducing Schedules
    13.7 Isolating Failure-inducing Changes
    13.8 Problems and Limitations
    13.9 Concepts
    13.10 Tools
    13.11 Further Reading
    13.12 Exercises

    14 Isolating Cause-Effect Chains
    14.1 Useless Causes
    14.2 Capturing Program States
    14.3 Comparing Program States
    14.4 Isolating Relevant Program States
    14.5 Isolating Cause-Effect Chains
    14.6 Isolating Failure-inducing Code
    14.7 Issues and Risks
    14.8 Concepts
    14.9 Tools
    14.10 Further Reading
    14.11 Exercises

    15 Fixing the Defect
    15.1 Locating the Defect
    15.2 Focusing on the Most Likely Errors
    15.3 Validating the Defect
    15.4 Correcting the Defect
    15.5 Workarounds
    15.6 Learning from Mistakes
    15.7 Concepts
    15.8 Further Reading
    15.9 Exercises

    Appendix: Formal Definitions
    A.1 Delta Debugging
    A.2 Memory Graphs
    A.3 Cause-Effect Chains

Product details

  • No. of pages: 544
  • Language: English
  • Copyright: © Morgan Kaufmann 2009
  • Published: June 12, 2009
  • Imprint: Morgan Kaufmann
  • eBook ISBN: 9780080923000
  • Paperback ISBN: 9780123745156

About the Author

Andreas Zeller

Andreas Zeller is a full professor for Software Engineering at Saarland University in Saarbruecken, Germany. His research concerns the analysis of large software systems and their development process; his students are funded by companies like Google, Microsoft, or SAP. In 2010, Zeller was inducted as Fellow of the ACM for his contributions to automated debugging and mining software archives. In 2011, he received an ERC Advanced Grant, Europe's highest and most prestigious individual research grant, for work on specification mining and test case generation. His book "Why programs fail", the "standard reference on debugging", obtained the 2006 Software Development Jolt Productivity Award.

Affiliations and Expertise

Saarland University, Saarbruecken, Germany

Ratings and Reviews

Write a review

There are currently no reviews for "Why Programs Fail"