Saturday, October 2, 2010

Sometimes a hyphen is just a hyphen

I had to smile as I read a recent post by Alfred Thompson on validating character input strings for name. In it, Alfred walks through a number of ways to test for valid alphabetic characters while not limiting it to only the 26 letters of our English alphabet.  Most options did not return the results he had hoped for.

You see, overly aggressive character validation was one of the reasons my wife became a programmer. Early in our marriage, Mrs. Advisory Bored used a hyphenated maiden/married last name. Most computer systems would not accept "maiden-married" as a last name. At some point she figured she couldn't do any worse than those programmers and she changed careers. 

I seriously doubt these businesses had a policy that said we don't want women with hyphenated last names as customers, but that's what they implemented.  It is important that programming students understand they aren't implementing code, they're implementing the business.  The implementation can't (properly) occur without the business context. 

And that's a lesson that is just as important as the return value from the isLetter function.