Data validation and verification
Data validation
A programmer should consider that any inputData which is inserted into a system for processing and/or storage. a user makes might be incorrect and should plan arrangements for such unexpected actions. Using validationChecking input data is sensible and in the right format. helps a programmer to ensure that any dataUnits of information. In computing there can be different data types, including integers, characters and Boolean. Data is often acted on by instructions. input is possible and sensible.
Validation applies rules to input data. If the data does not follow the rules it is rejected, reducing the risk that incorrectly input data may crash a program.
A programmer can build various types of validation into a program:
- Range check - the input must fall within a specified range. This is usually applied to numbers and dates but can apply to characters. For example, when making a payment to someone, the amount to be entered might be set to be greater than zero and not greater than the funds available.
- Length check - the input must not be too long or too short. For example, a surname will require at least one letter but is unlikely to require more than 40.
- Presence check - a data value must be entered. For example, entering a quantity when placing an order.
- Format check - the data must be in the correct format, such as entering a date in the format DD/MM/YYYY.
- Type check - the data must be of a specified data typeIn computer programming, data is divided up and organised according to type, eg numbers, characters and Boolean., such as an integerA whole number - this is one data type used to define numbers in a computer program. Integers can be unsigned (represent positive numbers) or signed (represent negative or positive numbers). when specifying a quantity.
- Lookup table - this allows the user to pick one item from a specified pre-defined list.
- Check digit - often used on identification numbers, such as bank account numbers, to ensure the numbers have been entered correctly.
Many programs use one or more of these validation checks. For example, when signing up for a user account on a website, the validation might include:
- presence check - a username must be entered
- length check - a password must be at least eight characters long
- range check - age restrictions may require the user's date of birth to be before a certain date
- format check - the user's date of birth must be entered in the specified format
- type check - the password may need to have a mixture of upper- and lower-case letters, a number and a special character
- look up check - the title must be from a pre-defined list of valid entries
Validation can be very simple. This program will iterate until the user enters a correct response.
response is string
set response = ""
while response <> "a" AND response <> "b"
input "Which option do you prefer? a/b",
response
end while
output "Okay, let's continue..."
Verification
Validation does not ensure that the data entered is correct, just that it is possible and sensible. A user may accidentally enter a date of birth that is possible and sensible, but incorrect. The program has no way of knowing that the date has been entered incorrectly.
To check if the data entered is correct, verification is needed. Take, for example, a customer鈥檚 email address. A company wants to make sure they get this correct so they might use data verification to ensure it is entered correctly.
There are two main methods of verification:
- Double keying - entering the data twice and comparing the two copies.
- Proofreading data - this involves someone checking the data entered against an original document. This is time-consuming and costly and is mainly used only for very important information such as the checking of ID.
To find out more, see the Internet and cybersecurity study guide.
More guides on this topic
- The CPU - Eduqas
- Primary storage - Eduqas
- Secondary storage and embedded systems - Eduqas
- Networks - Eduqas
- Internet and cybersecurity - Eduqas
- Data representation - Eduqas
- Storage and data organisation - Eduqas
- Operating systems - Eduqas
- Principles of programming - Eduqas
- Algorithms - Eduqas
- Software development - Eduqas
- Impacts of digital technology on wider society - Eduqas