2.3 Robust Programs
Range Check
Checks that a value falls within the specified range. e.g. number of hours worked must be less than 50 and more than 0
Presence Check
Checks that data has been entered into a field e.g. in most databases a key field cannot be left blank
Format Check
Checks the data is in the right format e.g. A National Insurance number is in the form LL 99 99 99 L where L is any letter and 9 is any number
Length Check
Checks the data isn't too short or too long e.g. A password which needs to be six letters long
Valid
Data that is correct
Tab
How do we ensure that our indentations are spot on? What is the key on the keyboard?
Maintainability
If a program is to be defensive against attacks then it has to be maintained and up to date. This is known as?
Invalid
Incorrect values such as entering 'Dave' in an age field.
Runtime Errors
These errors which may cause program errors or the computer to crash even if there appears to be nothing wrong with the program code.
Logic Errors
This is a bug in a program that causes it to operate incorrectly, but not to terminate or crash.
Iterative Testing
This is testing the code as you create it
Data Sanitisation
This trims or strips strings, removing unwanted characters from strings
Input Validation
Validation is a check made by a computer to ensure that the data entered is sensible or reasonable. It attempts to ensure that it is within certain limits or rules.
Out of Range
Values higher or lower than the expect range, for teenagers greater than 19
Red
What colour are comments?
Orange
What colour is a function?
Green
What colour is text?
Hash
What does # stand for?
Null Value
When no data is entered or left blank to test what happens.
Authentication
?????? is a coding method to check that a user is who they say they are and allowed to accesses the program.
Input Sanitisation
Another method for validating data and stopping attacks is to clean up the data that is inputted so that it is ready for the application to use.
Error
Another name for a bug in a program is?
Lookup Table
Looks up acceptable values in a table. e.g. There are only seven possible days of the week.
Spell Check
Looks up words in a dictionary e.g. MS Word uses red lines to underline misspelt words
Final or Terminal
Testing is carried out at the end of the program when it has been written
Test Plan
The following a featured in a ? - The test number - The data entered - The type of test data - The expected outcome - The result of the test - Action required as a result of the test
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
In Range
The maximum values of the data that could be entered for example for teenagers 13 - 19
Comments
These are characteristics of - To inform them reader of a bug or issues - To explain the code and its function in more detail - To stop a line of section of code from executing
Indentation
These are characteristics of - To group together a function - The code does not use a { syntax and indentation is used instead - If altering a function in the future it can be easily found.
Syntax Error
These are common? - spelling mistakes - incorrect use of punctuation - use of capital letters
Syntax Errors
These are mistakes in the way that the code is written.