Defensive Design Considerations: Flashcards
1
Q
What are the different checks?
A
- Type Check.
- Pressence Check.
- Range.
- Format.
- ## Length.
2
Q
What is input validation?
A
- Checking data inputted by the user.
- Meets specific criteria + rules before processing.
3
Q
What is a type check?
A
- Checks whether it is the correct data type.
- E.g:
- Integer.
- Strings.
- Real.
4
Q
What is a range check?
A
- Checks whether the data is entered in the correct range.
-
5
Q
What is presence check?
A
- Checks if data has been entered or in required fields.
6
Q
What is a format check?
A
- Checks if the format is correct.
- E.g: Days, months years.
- Postcode.
7
Q
What is a length check?
A
- Checks if it is the specific number of characters or over the specific minimun number of chaarcters.
8
Q
What are the advantages of validation?
A
- More robust.
- User friendly.
- Prevents errors.
9
Q
What errors can occur in a programme?
A
- Division by 0.
- Communication.
- Printer + Peripheral error.
- Disk errors.
10
Q
What is division by 0 error?
A
- No number when multiplied or divided by 0 will output a value/number.
- Make sure the code is dividing a number not by 0.
11
Q
What is a communication error?
A
- Online systems require connection to host servers.
- If server drops could cause programme to crash.
- Programmer should enable ways for the user to cancel requests + fail gracefully + reporting the connection error.
- Programme can automatically resume when connection is avaliable again.
12
Q
What is a printer and peripheral error?
A
- When a Programme outputs a hardcopy, printer could run out of ink and paper, jam.
- Programmer should not assume:
- Output to printer was sucessful.
- Should always have options to reprint reports and receipts.
13
Q
What is a disk error?
A
- Programs that read and write to files need to handle many types of exceptions:
e. g: - file/folder not found.
- disk being run out of space.
- data in file being corrupted.
- robust programmes handles this:
- Checks files + data before attempting to use them for further processing.