GCSE Computer Science: Unit 2.3 Robust Programs L1
Data Validation
A method of checking whether data is valid
Input Sanitisation
Another method is to clean up the data that is inputted so that it is ready for the application to use. Some users may add additional data to try and access the program or provide clues on how to access the program. Data sanitisation trims or strips strings, removing unwanted characters from strings For example, Dave not dav%e, the % would be removed This ensures that the input is correct and contains only the permitted characters, letters and symbols.
Authentication
Authentication is a coding method to check that a user is who they say they are and allowed to accesses the program.
Range check
Checks that a value falls within the specified range
Presence check
Checks that data has been entered into a field
Format check
Checks the data is in the right format
Length check
Checks the data isn't too short or too long
Indentation
Code is indented for a number of reasons. 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.
Comments
Comments in programs serve a number of purposes 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
Maintainability
If a program is to be defensive against attacks then it has to be maintained and up to date. API and code changes, which means that programs will need to adapt to complement new requirements. Comments and indentation are two methods to provide information for future users or programmers that may be required to maintain the code.
Lookup table
Looks up acceptable values in a table
Spell check
Looks up words in a dictionary
Physical authentication
New software often requires a key code which is generated by an app on the users phone and then entered. Online banking requires a user to enter credentials into a webpage and then a number is generated which is entered into a key device.
Check digit
The last one or two digits in a code are used to check the other digits are correct
Input Validation
Validation is a check made by a computer to ensure that the data entered is sensible or reasonable. It cannot check that it is correct because a user may lie or make a mistake. It attempts to ensure that it is within certain limits or rules.