It’s shit like this, developers

This week I was changing some contact details for a large company I’m dealing with when I encountered this gem of user interface design:

Here I was trying to enter my new zip code. When clicking ‘confirm’ the website informed me that this was an invalid zip code. The error message (in Dutch) says:

The zip code must contain 4 digits and two characters.

Hey, my zip code does have 4 digits and two characters. Why is this not being accepted? Well, because of the space between the digits and the characters.
Every time I see this kind of behaviour, I’m thinking of the Robustness principle.

Be conservative in what you send; be liberal in what you accept.

The programmer who created this probably just used a regular expression (something like \d{4}[A-Za-z]{2}) without considering the fact that people often write zip codes with a space. You know, like they do on regular letters.

The programmer had several options:
  • Create two input boxes (one for the digits, one for the characters) so I had visual feedback that they expected me to separate the digits and the characters. 
  • Write some client side scripting that disregarded any spaces I might enter. 
  • Actually try to parse my input before throwing their hands in the air and crying: “I give up! Will those users never learn!”. 
How much effort would it have been if the validation code first had stripped any whitespace from my input and then tried the regular expression method? It would have worked fine and I wouldn’t have been bothered with this break in my workflow.

So, next time you write some validation code (for dates, names, zip codes, whatever), think of the user and try to do your best to parse the input of the user before giving up.

(One of the reasons I like Remember The Milk so much is because they support a large number of input formats).


  1. This exact example is something I came across a lot of times also, while it's easy to relieve the frustration of the user while he's trying to input his zip code and doesn't know what's wrong :)


Post a Comment

Popular posts from this blog

Small tip: use QueueBackgroundWorkItem for asynchronous work in ASP.NET

Why you should use git merge --no-ff when rebasing.

Set default merge options for Git branches