Defensive Programming and Testing (yr 11) Flashcards
What is defensive programming?
Defensive programming is a practice of writing code that anticipates and handles misuse, errors, and unexpected inputs to make programs more reliable and secure.
Name three defensive design techniques.
- Input Validation: Ensures inputs are in the expected format.
- Authentication: Verifies user identity (e.g. login systems).
- Maintainable Code: Using comments, indentation, and meaningful variable names to improve readability.
What is iterative testing?
Testing carried out during development to ensure each part of the program works as it is built.
What is final/terminal testing?
Testing performed once development is complete to check the whole system meets requirements.
What is a trace table?
A table used to manually track the values of variables and outputs at each step in an algorithm to detect logic errors.
What is the difference between normal, boundary, and erroneous data?
• Normal data: Inputs that are expected and valid.
• Boundary data: Values at the edge of acceptable ranges.
• Erroneous data: Invalid inputs used to test error handling.