Type Validation

A database and programming term.

The old saying "You can't put a quart in a pint pot" is what type validation is all about.

When a programmer tries to load a variable with the incorrect type of data, an error will occur. This usually results in corrupted data or a software crash.

For instance, a 'byte' can hold values up to 255 decimal. If you try and put 1 million into it, the result will be incorrect. Another example, a string variable is intended to hold text such as 'Hello", but the programmer accidentally writes code to load it with a floating point number, again an error is likely to occur.

Type validation is the process where the system checks if the data being passed or loaded is of the correct type. Many programming languages support type validation so that the compiler will warn you of a 'type' violation as it tries to create the executable file.

Example program snippet

var myvar int;

myvar = 1222 ( This is ok as the number is within the integer limit and contains no decimal point)

myvar = 1.2233 ( This is not ok as an integer cannot hold a decimal value)

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Type Validation


back to glossaryback to glossary