Syllabus Detail
- Types of data validation techniques including; range checking, type checking 12 ATAR
Background
- Data validation is the process of ensuring data integrity and usefulness
- We use validation techniques to make sure our data is both accurate and clean (it won't "break" our program)
- Two main forms of data validation are used: range checking and type checking
Range Checking
- A range check is used to make sure our data falls within the "boundaries" that we set
- We can look at it as the scope of values that our data can fall within
- Range checking is most commonly used on data that involves numbers and figures
Example:
Type | Description | Data Validation |
Maximum | The maximum grade possible for Computer Science is 100% | <= 100 |
Minimum |
The minimum grade possible for Computer Science is 0% | >= 0 |
Range | To achieve an 'A' grade in the Computer Science course you must score between 75% and 100%. | >= 75 AND <= 100 |
Type Checking
- A type check is a simple check on the type of data being put in to or pulled out from a function
- We do these checks to ensure that the program will not "break" from an incompatible data type
- These are often used for date / text fields (including mail addresses) to validate the address or date entered is correct
Example:
Type | Description |
Type |
Number | The number entered must be in numerical form. E.g. not "ten" | 10 ≠ ten |
|
The email address must follow correct syntax and resolve to a real domain | This email address is being protected from spambots. You need JavaScript enabled to view it. |
Date | The date must be valid (e.g. there is no 34th day or 13th month) | 34/13/2012 |
Further Research
- (Advanced) Check out this lecture on Type Checking from Chalmers.se here
- Check out RevisionWorld.com's article on Checking Data / Data Quality here
Worksheet and Practice (yet to be added)
Found an error or have an enhancement? Please let us know via this contact form