CSCE 315 Lecture 11
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
- Stabilize the error: find the simplest test case to reliably produce the error
- Locate the source: find where in the code the error occurs. Take a break if necessary
- Fix the defect: change only what you absolutely need to change
- Test the fix: check the test case that caused the error and with other test cases
- 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