Topics / Programming / Validation

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.

Validation methods

Validation MethodDescription
Range checkChecks the data falls between an acceptable upper and lower value, within a set range
Type checkChecks that the data entered is of an expected type, e.g. text or a number
Length checkChecks the number of characters meets expectations, e.g. an 8 character password
Presence checkChecks that the user has at least inputted something, stopping them from accidentally entering nothing
Check digitAn extra digit added to a number which is calculated from the other digits, this ensures the rest of the number has been entered properly

 

Topics / Programming / Validation