CSCE 315 Lecture 11

From Notes
Jump to navigation Jump to search

« previous | Monday, February 13, 2012 | next »


More Heuristics

  • Consider using brute force
  • Draw Diagrams
  • Keep designs modular (information hiding; black boxes)


Design Practices

  • Iteration (select the best of several attempts)
  • Decompose problem in several different ways
  • Top Down vs. Bottom Up
  • Prototype
  • Collaboration and code review
  • Design until implementation seems obvious


Debugging

Not a random process; systematic approach

Term "Bugs" has been around for a long time (Mark I)

Sources

  • Bad Design
  • Bad Isolation
  • Typos
  • Changes that aren't complete
  • Better programmers are better debuggers


Process

  1. Stabilize the error: find the simplest test case to reliably produce the error
  2. Locate the source: find where in the code the error occurs. Take a break if necessary
  3. Fix the defect: change only what you absolutely need to change
  4. Test the fix: check the test case that caused the error and with other test cases
  5. Look for similar errors: similar routines and functions may also have the same error

Figure out why the error occurs so as to not make the same mistake again