Topics / Programming / Validation
Validation is an automatic check to ensure that data entered is sensible and feasible.
Validation cannot ensure data is accurate.
When programming, it is important that you include validation for data inputs. This stops unexpected or abnormal data from crashing your program and prevents you from receiving impossible garbage outputs.
|Range check||Checks the data falls between an acceptable upper and lower value, within a set range|
|Type check||Checks that the data entered is of an expected type, e.g. text or a number|
|Length check||Checks the number of characters meets expectations, e.g. an 8 character password|
|Presence check||Checks that the user has at least inputted something, stopping them from accidentally entering nothing|
|Check digit||An extra digit added to a number which is calculated from the other digits, this ensures the rest of the number has been entered properly|