The analysts and developers amongst you will probably need to design an approach to capturing and storing postal addresses at some point during your career.
On a typical project, the design for this aspect may not be considered significant. It is, more than likely, just a handful of user stories in comparison to a burgeoning product backlog (aka requirements for any Waterfallers).
As such, how many address data structures get designed with three simple requirements in mind:
Now I wouldn’t recommend basing your design decisions on your answers to these questions but it might not be a bad start. In fact, you may find that you can support most addresses in this way.
But there are some “edge” cases that can cause problems. It’s these situations that might disrupt someone entering their address on your payment form (sale lost) or prevent your marketing team from delivering their message (truncated address on envelope).
DEFRA abbreviate their name for good reason: to make up for the fact that they possess the longest UK address.
Department for Environment Food & Rural Affairs (D E F R A)
State Veterinary Service
Animal Health Office, Hadrian House
Rosehill Industrial Estate
Ensure your data structure field length can support this example (and then some).
Like this one for instance: Elba, DUNS, TD11 3RY.
Don’t validate fields on the basis of their length alone.
Not usually but sometimes: HD7 5UZ in Huddersfield covers 7 streets.
Don’t use postcode and house number as a primary key, it’s fallible.
CV4 7AL provides over 5800 residences for the students and staff at the University of Warwick.
Consider how best to page through addresses on your user interface.
Here’s one such example:
Apartment 1 Sub-building name
The Jam Works Building name
49–51 Fleet Street Street number and street
Design to capture and store both (and don’t use a generic house name / number field).
There are several memorable postcodes in PAF® like GIR 0AA for Girobank (it’s just a pity they went and changed their name to Santander).
Don’t rely upon the first two characters always helping you to resolve down to an area.
These our own thoughts but if you want to read more, check out Falsehoods programmers believe about addresses. It’s an interesting read (even if you’re not particularly interested in addresses).
Our postcode lookup API can also help you handle all of these too.