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.


blog comments powered by Disqus