To Documents
Debugging Checklist
Data Initialization
- Any improperly initialized variables?
- Variables of correct datatype? (x = 2 vs. x = 2.0 vs. x = "2")
- Any misspelled variable names?
- Variables with similar names confused?
Computation
- String subscripts within bounds?
- Any non-integer string subscripts?
- Off-by-one errors in indexing or subscripting operations?
- Mixed-mode computations?
- Intermediate result overflow or underflow?
- Division by zero?
- Floating point inaccuracies?
- Operator precedence understood?
- Integer divisions correct?
Comparisons
- Comparison relationships correct?
- = used instead of ==?
- Floating point comparisons correct?
- Boolean expressions correct?
- Improper comparisons of floating point values
- Operator precedence understood?
Control Flow
- All cases covered in if or case statements?
- Should there be a default case in if..else statements?
- If statement used when elif should be used or vice versa?
- Will each loop terminate?
- Will program terminate?
- Any loop bypasses because of entry conditions?
- Possible loop fall-throughs using case statement correct?
- Any off-by-one iteration errors?
- Indentation correct? Remember indentation is essential for Python syntax.
Method Calls
- Method names spelled correctly?
- Method names capitalized correctly?
- Number of arguments correct?
- Types of arguments correct?
- Order of the arguments correct?
- Package containing method used imported correctly?
Input/Output
- Print used when puts is appropriate or vice versa?
- Format string correct when using str.format
- Spacing correct. Is a sep and/or end argument needed in print statement?
- Input checked for validity?
- Textual or grammatical errors in output?
- Files opened correctly?
- Files closed after using?
Other Checks
- Use of single quotes when double quotes required?
- Warning messages?
- Import statements correct?