2.3 Producing Robust Programs COMPLETE Flashcards
What is a check digit?
The last one or two digits in a code are used to check the other digits are correct
E.g. bar code readers in supermarkets use check digits.
What is a format check?
Checks that the data is the correct format.
E.g. National Insurance Number in the form LL 99 99 99 L where L is any letter and 9 is any number.
What is a length check?
Checks that the data isn’t too short or too long.
E.g. a password needs to be more than 8 characters.
What is a lookup table?
Looks up acceptable values in a table.
E.g. there are only 7 possible days of the week.
What is a presence check?
Checks that data has been entered into a field.
E.g. in most databases, a key field card can’t be left blank.
What is a range check?
Checks that a value falls within a specific range.
E.g. number of hours worked (h):
0 < h < 50
What is a spell check?
Looks up words in a dictionary.
E.g. Microsoft Word underlines incorrectly spelled words in red.
Define authentication
A coding method to check that a user is who they say they are and allowed to accesses the program.
The program checks a huge table and reports back to see if the information matches up, if it does then the access is granted
E.g.biometrics, key cards or email.
Define input sanitisation
Ensures that the input is correct and contains only the permitted characters letters and symbols.
E.g. Dave not Dav%e so the % would be removed.
Define maintainability
If a program is to be defensive against attacks, then it has to be maintained and up to date.
Informs the reader of a bug or issues.
Explains the code and its function in more detail.
Stop a line of section of code from executing.
E.g. comments and indentation/spacing.
Define misuse
Maybe in the form of a brute force attack on the program.
Unauthorised acts with intent to impair the operation of the computer.
Define iterative testing
Testing the code as you create it.
E.g. line by line or a section at a time.
Define final testing
Carried out at the end of the program when it has been written.
Define syntax errors
Mistakes in the formatting (the way in which the code is written).
E.g. SPAG mistakes or unneeded capital letters.
Define logic errors
A bug in a program that causes it to operate incorrectly, but not to terminate or crash (not as intended).
Define validation
A check made by a computer to ensure that the data entered is sensible or reasonable and within certain limits and rules.
What should you consider in defensive design?
When data is entered into a program, it’s important that it’s valid, in order for the program to work correctly.
When are runtime errors detected?
Errors which may cause program errors or the computer to crash, even if there appears to be nothing wrong with the program.
E.g. running out of memory.
Computer programs should/shouldn’t be designed to ensure that they can cope with unexpected or erroneous input from users
should
True/False: Defensive design ensures that there are no errors or bugs
False, the number of errors or bugs is minimised
True/False: Defensive design ensures that the program behaves as expected in spite of unexpected user actions
True
True/False: Defensive design ensures that all possible errors that could occur are identified and allowed for
True
Computer scientists should/shouldn’t plan for all contingencies that might occur
Should. These include accidental or deliberate erroneous inputs or item selections
______________ is the process of determining the identity of a user
Authentication
What is authentication usually based on?
A username and an associated password
What does authentication do with a username and password?
Checks that the username and password exist