2.3 Producing Robust Algorithms Flashcards
Robust program
A program that is fault-tolerant and difficult to break/crash.
Defensive design
programs should be designed to be robust and to not crash if a user does something unexpected.
Defensive design considerations
- Input sanitisation/validation
- Anticipating misuse
- Authentication
Input sanitisation/validation -
validation checks such as length checks and format checks can help to avoid causing errors.
Anticipating misuse -
assume that users will try to break the program.
Authentication
using logon systems with passwords to make sure the user is who they say they
are.
Iterative testing -
testing that is carried out during production.
Final/terminal testing -
Carried out just before the final program is released.
Testing techniques
- Test with erroneous data
- Test with valid data
- Test with boundary data
Erroneous data -
Data that is not valid.
Boundary data
Data ‘on the edges’ of being acceptable
Logic errors
Errors that mean your code works but not as intended e.g < instead of >. These will not be picked up by the IDE.
Maintainability
Ensuring that code is easy to follow and repair/improve/edit.
Ways of making code more maintainable -
Comments, indentation, meaningful variable names and use sub-routines.