+ All Categories
Home > Documents > College of Alameda [email protected] Copyright © 2007 Patrick McDermott Vincent van Gogh...

College of Alameda [email protected] Copyright © 2007 Patrick McDermott Vincent van Gogh...

Date post: 15-Dec-2015
Category:
Upload: terrance-mowry
View: 214 times
Download: 0 times
Share this document with a friend
12
Programming Data Validation College of Alameda [email protected] Copyright © 2007 Patrick McDermott Vincent van Gogh (1853-1890) The Langlois Bridge March 1888
Transcript

ProgrammingData Validation

College of [email protected]

Copyright © 2007 Patrick McDermott

Vincent van Gogh (1853-1890)The Langlois Bridge

March 1888

Do Them All!

• Every Last Stinkin’ one!

• Try to Get a Rhythm

Bargehaulers on the VolgaIlya Repin, c. 1870-73

O E O!

Kinds of Garbage• The Quality of system output is no better

than the Quality of the input• Problems of Type: Wrong type of data

– Putting Phone Number in Credit Card– Text in a Numeric field

• Problems of Quality: Defective data– Wrong phone number– “Dirty Data”

Keeping Your Data Clean Restricting the Type of Data in a FieldRestricting the Amount of Data in a FieldSpecifying the Format of Data in a FieldRestricting Data by Using Validation RulesCreating a Simple Lookup ListCreating a Multi-Column Lookup ListUpdating Information in a TableDeleting Information from a TablePreventing Database Problems

Program Structure• Check all at Top of Module

– Defensive Programming?– If Error, Report & return

• Violates Single-Entry-Single-Exit Rule

• Make Exception to 1E,1X

• Make a Big if• Have Validation Function()

How Many Messages Just One, or Many?• Make the Message Clear

– Avd Mystrs Abrvtns– Word from User’s Viewpoint

• Suggest Correction– Numbered, with Reference?

• Abused children can become abusers– Abused programmers write bad messages

Joan Brown (1938-1990)The Message, ca. 1977

Poka Yoke• The Best Way to fix an Error is to not

make it• Mistake Prevention

– Prevent the Errors• Mistake Proofing

– If you can’t prevent all errors, at least catch them

Warnings?• Compilers: Information, Warning, Error, Fatal

• Warn vs. Block vs. Audit trails• Provide an Override

– MoU: Master of Universe– POG: Power of a god Warning!

Extreme Danger!

Error Prevention• Don’t Let In

– Menu, Radio Button, List– Look-Up Table– The Choice isn’t there– You need to know all choices

• Let in, then Edit (Don’t store)• Correct Later

– Report– Batch

Edit It• If no direct use, gets dirty (good econ

strategy—it don’t matter)• Warn versus forbid• Once good, now bad (allow old to

remain?)• Flexible versus accurate• Type I Type II

Complex CheckCrosscheck Fields

If Gender == Male, NOT Pregnant

If Status == In Default, Credit Limit = 0

Stop Error, or Correct it?

Table Maintenance• If Item Removed

– Are those on DB invalid• or “Grandfathered”

– If Updated, it will Fail Edit• If Item Added

– Is it a split of an existing category?• Validation Table

– Are Values in Code, Table, or in UI?– Does User or Programmer Update Table?

• How Stable is The List?

Christo & Jeanne-ClaudeWrapped Table, 1961


Recommended