I recently stumbled upon a great entry from 2007 on Phil Haack’s blog: Don’t be a Validation Nazi, where he writes about the perils of being overly strict on validation. This is an area close to my heart, as I’ve seen so many systems end up user hostile due to overly strict validation. This can be particularly frustrating when it’s forced on the system by a misguided analyst.

Here’s what I wrote as a comment on that blog entry:

Postel’s Law aside, another reason to be liberal in what you accept is that not everyone does it the same way.

Case in point: Phone numbers.

Not everyone follows the US model of 123-123-1234.

For example, mobile phone numbers in New Zealand all have area code 02x, where x is the mobile provider: 025/027 for Telecom, 021 for Vodafone, and so on. After that prefix, some numbers are 6 digit, some are 7, and some are 8.

And, if I mangle my mobile number sufficiently to fit your US template, I’ll do so by leaving out my country code, which renders the phone number useless!

I’ve run into similar problems with suburb names - people who “helpfully” correct “Kelson” into “Kelston”, when one is in Wellington and the other in Auckland. Or who assume that “Merivale” must be in Christchurch, when there’s a “Merivale” in Tauranga as well.

Bottom line: Who knows the phone number better? You, when you don’t even know the user in real life? Or the user themselves, who might have been giving out that phone number as a contact for 30 years?

Exercise some trust that they know what they’re talking about!

If they care about you being able to contact them, they’ll take care to ensure the details are correct. If they don’t care, no amount of machine validation will be sufficient.

We can generalise this for any system: If you want the information in the system to be reliable, if you want any metadata to be accurate, you need to find a way for the end users to care about the quality of that information. No amount of mechanical rule checking can force quality inputs. Worse, making things overly strict can limit the usefulness of the system dramatically.

Next Post
Importing Excel data with SSIS  04 Feb 2011
Prior Post
Strategies for becoming a better programmer  26 Jan 2011
Related Posts
Browsers and WSL  31 Mar 2024
Factory methods and functions  05 Mar 2023
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
Archives
January 2011
2011