JMU
The Programming Process
An Overview


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Review
Program Analysis
Program Analysis - Examples of Static Analysis
Program Analysis - Examples of Dynamic Analysis
Testing - Terminology
Testing - Stages
Testing - Approaches
From Testing to Debugging
Debugging - The Process
  1. Stabilize - Understand the symptom and the trigger condition identified by the test so that the failure can be reproduced.
  2. Localize - Locate the fault.
    • Examine the sections of code that are likely to be influenced by the trigger condition.
    • Form a hypothesis about the fault.
    • Instrument the relevant sections of code.
    • Execute the code using the instrumentation.
    • Prove or disprove the hypothesis. If proven, go to step 3; otherwise go to step 2.
  3. Correct - Fix the fault.
  4. Verify - Test the fix and run regression tests.
  5. Globalize - Look for and fix similar defects in other parts of the system. Refactor if necessary.
Debugging - Instrumentation Techniques
Putting it All Together - The Programming Process
  1. Understand the problem domain and the specific problem
  2. Decompose the problem into parts
  3. Create an algorithm/heuristic for solving each part of the problem
  4. Use the algorithm to solve examples of each part of the problem by hand
  5. For each part of the problem:
    1. Implement the component/module (which will consist of algorithms and data structures) in the programming language being used
    2. Test the component/module
    3. If necessary, debug the component/module
  6. Test and debug the complete program