2.3 Robust Programming Flashcards
Defensive Design Considerations
- Authentication
- Anticipating misuse
Authentication
Verifying the identity of a user.
Examples of Authentication
Username, password or biometrics
Anticipating Misuse
Designing a program in a way that is resilient to potential misuse.
Types of Anticipating Misuse
- Division by 0
- Communication error
Validation
Checking input data is sensible and in the right format.
Types of Input Validation
-Type check
- Range check
- Presence check
- Format check
- Length check
Type Check
Is the input the correct data type?
E.g. Inputting an integer where it asks for a name.
Range Check
Is the input within range?
E.g. Inputting 1000 where it asks for age
Presence Check
Has required data been entered?
E.g. Mandatory questions on google form
Format Check
Correct format?
E.g. DD/MM/YYYY
Length Check
Does the input have the correct number of characters?
E.g. 8 character password
Advantages of Input Validation
- Make a program more robust
- More user friendly
- Prevents further errors later on
Maintainability
The process of ensuring that a program is easy to understand, modify and update.
Maintainability Techniques
- Use of subprograms
- White space
- Indentation
- Relevant variable names
- Comments