Put the ZIP code first
61 points by diktomat
61 points by diktomat
I think the “note for international visitors” banner at the top has been added since I looked at this last night (I wonder what it says to visitors from other countries). Without that caveat it was an embarrassingly parochial example of falsehoods programmers believe about addresses (previously, previously), eg I couldn’t even enter my postcode because it doesn’t fit in 5 digits. The author seems to have learned from the flames on the orange site that you can’t infer the country from the zip code, though they haven’t yet fixed the confident falsehood in the first paragraph…
Funny thing, the banner seems to be automatically filtered out by ublock origin for some reason. So I didn't even see it (I'm in Poland) until I disabled ublock on the page.
It fetches from https://api.country.is, which is blocked by EasyPrivacy. And then it’s wrapped in a try{…}catch(e){}, so the whole humorous thing is cut.
I do think the text of the article really mangles this, but we should keep in mind that "ZIP Code" is a trademark of the United States Postal Service and completely specific to the US. It would be a different matter of the article said "postal code" but it doesn't, it uses a US-specific term.
I believe that the term ZIP code is also used in the Philippines.
For example see: https://phlpost.gov.ph/zip-code-locator/
I wonder what it says to visitors from other countries
view-source:https://zipcodefirst.com/
Pleasantly readable.
The author is making it out like the country can be derived from the ZIP code... but of course interpreting the ZIP code requires the country to begin with. In their live demo I started by typing my Dutch postal code. Surprise surprise, I wasn't able to type my entire postal code and the demo did nothing, least of all autoguess my country.
So half of their complaint about how selecting their country from a dropdown list would be unnecessary isn't actually true.
Of course, you could probably take the ZIP/Postal Code and filter down to the list of countries matching that postal code format, that would be a nice service to have... (and have a checkbox for countries without postal codes)
Fun fact: Zip codes are derived from USPS infrastructure and logistics, not political boundaries, and so there are some strange edge cases. Namely, there are a handful of Zip codes which span US state boundaries. For example, 59221 has bits of both Montana and North Dakota for a post office on the Montana side, so all the addresses on the North Dakota side have Montana addresses despite their physical locations.
For instance: https://maps.app.goo.gl/1vewfhXegA6WkqZX8
Fun lesser-known facts that doesn't really have anything directly to do with the post: US Zip codes can have more granularity with 9 or 11 total digits. 11 digits unique digits identify every mailbox in the country (or "delivery point" to use USPS parlance). They're not really used outside of USPS systems or presorting companies, who offload work from USPS and put barcodes with the full 11 digits on mail pieces to get rate discounts.
I work in the postal & logistics industry (not for USPS directly) and have had quite a lot of fun learning about silly things like this at the intersection of geography and technology.
Once upon a time I had a fun postscript snippet that was able to generate the zip+4 barcodes that were under the mail https://en.wikipedia.org/wiki/POSTNET#Example and my laser printer accepted #10 envelopes, making it super easy to output sane addressing. It just made me happy thinking that I was helping improve the efficiency of delivery in some tiny way
It's fun that a trained eye can pretty easily decode the old POSTNET barcodes. They were deprecated and replaced circa ~2013 by the Intelligent Mail Barcode (IMb) 4-state barcode that is quite a bit more complex, but has more data and better checksumming. They also contain USPS service type, mailer info, and a serial number which can be used to trace a piece back to the machine which sorted it in case of processing errors.
I understand that some mailers were upset that they could no longer decode IMbs with a quick glance when they were introduced :P
Fun fact: Zip codes are derived from USPS infrastructure and logistics, not political boundaries
In Britain we have the concept of a “post town”, the town used in rural postal addresses. It’s the town containing the post office that serves addresses in nearby villages, often not in the same county.
The structure of British post codes was determined by the logistics. It has two space-separated parts called the outcode and the incode, which correspond to two stages of sorting. The first stage takes mail collected from nearby post offices and pillar boxes and determines which other sorting office it should be sent out to. Incoming mail from another sorting office is sorted according to the second half which corresponds to part of a postie’s delivery walk.
(It’s more complicated than that, of course, and the implementation has changed a lot since postcodes were designed. For instance, there never were strictly two stages; I believe there are now only a few large sorting offices so local post offices don’t sort by outcode any more.)
Regarding edge cases, I also wonder if zip codes change over time (e.g., new ones being added).
I had to work with Portuguese zip code validation at $WORK and I realized everything's much more nuanced than it seems at first!
Related to this: if your country picker includes “United States Minor Outlying Islands” and it comes up before “United States”, you have failed.
First, nobody from USMOI is using your website, and second, if they are, the six people on Wake Island get their mail just fine if they write “United States”.
90210 is a zip code that exists in Finland too. Sadly these posts, while understandably "correct" are often very US centric and fall flat on their first at that point.
Edit: looks like there is a banner, though it was disabled by ublock
I like this post, but:
Aside: I wish we'd just figure out a virtual post box address system. Gimme a number that doesn't let shippers know address, lets the mail easily follow me if I move, lets me change it if I have a security reason to, and has a checksum system for easy client side verification.
Aside: I wish we'd just figure out a virtual post box address system. Gimme a number that doesn't let shippers know address, lets the mail easily follow me if I move, lets me change it if I have a security reason to
PO boxes plus the USPS forwarding system seems to be pretty close to this...
and has a checksum system for easy client side verification.
...though not this. What do you have in mind for that? What would be checksummed, and what would verify that checksum?
What would be checksummed, and what would verify that checksum?
I imagine they're thinking of something like the Luhn algorithm used for credit card numbers so that the form wouldn't validate if someone fat-fingered the number.
In the UK most online shops do this.
Post code and then a drop down to select your house.
In the UK the postcode identifies a number of buildings, usually on the same street. That makes it possible to have a dropdown for the rest of the address after the post code. Very different world than zip codes.
Even if zip codes don't restrict things quite as much, a zip code will usually give you a small number of towns, a single town / city, or the ward of a large city.
In my case it gives the wrong city, because zip codes are postal delivery routes not administrative polygons. Recently Amazon started rejecting our real and correct address as “invalid” because they make this same error, even though I live in a major city with 100s of thousands of residents. The article is bad and wrong.
The postal service will deliver just fine with either city name. If this isn’t for mail delivery, it shouldn’t ask for ZIP at all.
That makes it possible to have a dropdown for the rest of the address after the post code.
And sometimes that dropdown is even sorted correctly!
But 99% of the time for my postcode, good luck finding number 18 in the list of 20 flats. Is it in position 18? NEVER! Is it after number 7? Sometimes! Is it after number 8? Sometimes! Is it after number 2? Sometimes! WHO KNOWS!?
Oh, how we laugh* every single time.
In the Netherlands, postcodes are even more granular, to the point that it's standard to just provide the postcode and the house number.
Coming from Belgium, where we have a 4 number postal codes but you still need to provide the whole address because 1 postal code is roughly a municipality, the Dutch system just blew my mind first. It is super convenient and easy to use.
Technically, the country field should be first and multiple towns sometimes share a zipcode but otherwise this is solid. I think even pre-selecting the country based on IP wouldn't be bad either.
Here in Germany, I've been noticing more websites will auto-complete the entire address when typing in the street. It's an important but I still would love if everywhere defaulted to the zipcode first.
Most websites in Japan do this, and in fact, I yesterday discovered that mozc (Japanese IME) can autocomplete your postal code to a full address if you type it in and hit Tab in the completion box.
It's actually a feature of Japanese addresses that they go from least specific to most specific.
The implementation proposed on the website is a bit America-centric if you offer international shipping, though. Postal codes in Poland are also 5 characters long, and if I typed 55100 I'd get… something in the US rather than the city where I was born. I'd instead put the country field first and then the postal code after that.
TBF this is covered in the last section, even if it does make the article incorrect on its face:
Fine, maybe country first. The purists in the comments are technically correct — postal codes aren't globally unique. You could do country first
then — the pièce de résistance — scroll through 200+ countries to find United States, which half the time is filed under "T" because some dipshit thought "The United States of America" was the correct sort key.
No, I click on the country dropdown, type in "Pol", and that's probably enough to find Poland. Well, unless someone reimplemented the dropdown from scratch instead of using the system one, but y'know. It's a pretty nifty feature, maybe the GUI could make it more clear you can do that.
On another note, I suppose it's interesting to know that my go-to fake ZIP code is Schenectady, New York.
Don't believe me, try it
I tried my Berlin zip code and it sadly failed.
Jokes aside it's potentially not that easy depending on the country.
I happen to live in a ZIP code that covers multiple cities. There's a handfull of ZIP codes that cross state borders (although i couldn't find any that cover more than two). As much as I hate it, the Google Maps geoip-assisted-search-with-autocorrect is the only system I've seen handle (most of) this complexity.
There also needs to be a fifth tier for websites that reject ZIP+4 codes.
I started laughing halfway through the body of text because I remembered having to fight forms a few years ago anytime I typed “60525”. Sir did you mean La Grange? Or Mc Cook? Surely you didn’t mean Countryside or Hodgkins? Definitely not Indian Head Park?
Someone already figured out a long time ago that placing the zip code first even in the US was very impractical. This is not a new debate and certainly not the first time someone has advocated for it.
The last two places I've lived share a zip code between two villages (this is in Chicagoland suburbs, with 10s of thousands of residents in those villages). Routinely, websites will "autocorrect" the name of the city with the wrong one.
Now we share a post office and have a reasonable address assignment system so the few times that mistake wound up printed on an envelope or something, it would make it to me. But my point is that it's hard to beat the user writing what they mean in plain text because your database may be inaccurate.
Also funny story, AT&T believes our single family home is an apartment building, they also don't have my village listed when inputting my address and it requires manual correction/explanation to a human every time its come up.
In Czech Republic (much smaller country than USA) it is quite common that you start filling the street and autocomplete offers you real street names and building numbers; when you select one, the city and zip code are filled automatically.
Free postal code lookup? Not if you're Canadian, Irish, or ...
About the only thing you can infer from a Canadian postal code is that, if your second character is 0, you're gonna pay a lot more to have stuff delivered. As all of the subdivisions built on former farmland are finding out.
https://zippopotam.us/ Supports Canadian prefixes. There are some others that support full lookup for free with small volume as well
Indeed. That's what I said :)
Apologies, I didn't imply to contradict you, merely "and here is some specifics that I found". I'm sorry if it came across as contradicting you :-(
I hope they don't forget the extra 4 digits of the ZIP code, which is also used for sorting...
Zip code autocomplete is very common/nigh universal on Japanese websites. As an intern way back I had done a whole thing of parsing the Japan Post CSV then dropping a bunch of files (one per zip code) into S3 (well, our softlayer equivalent) and then being confused as to why these files took up 2 gigs instead of the couple megs of the original CSV. How I learned about file block size l
Australia has by far some of the better UX on this though, with a lot of websites just directly hooking into I think Google maps autocomplete. You start typing your address free form into a box and it just has a dropdown that has basically every address in the country.
And of course for the OP: there's value in capturing a zip code you don't use. Zip Codes serve as good error checking bits. Someone can misspell a street name but the zip code saves you. Someone can misspell a zip code and then the rest of the info is there for you.
Postal offices try pretty hard to deliver stuff!
(In Japan people tend to have their names posted near mailboxes (not just a Japan thing) so you even get things like "we tried to deliver this to you but the name on the mailbox is entirely different, is this really you??"-style stuff)