A famous slogan in computing sums up the importance of accurate data:
GIGO = Garbage In, Garbage Out
Conclusions are no better than the data they are based on.
A major task for any program that accepts data is to try to
guarantee the accuracy of the input. Some kinds of errors cannot be caught but many of the most common kinds of mistakes can be spotted by a well-designed program.
A program should attempt to do the following:
|1.||test data type and format||ex.||2/a/96 is not a date|
|ex.||If a phone number should have exactly 10 digits with the area code, then 555-123 is not acceptable.
|2.||test data reasonableness||ex.||231 should not be a person's age, at least not since the time of Noah and the Flood|
|ex.||A sale of $50,000 worth of chewing gum at the corner market is probably missing a decimal point somewhere!
|3.||test data consistency||ex.||A man's death date should be later than his birth date!|
|ex.||The sum of the monthly paychecks should be the same as the total
paid for the year.
|4.||test for transcription and transposition errors||ex.||Typing 7754 instead of 7154 is a transcription error, typing the wrong character.|
|ex.||Typing 7754 instead of 7745 is a transposition error, interchanging two correct characters.
Both are very hard to check for!