Live data from Hacker News

Falsehoods programmers believe about addresses

mjt.me.uk

51–60 of 150 posts

Re: Falsehoods programmers believe about addresses

#51
That article can also be read as a list of things that need to be fixed by the various postal systems.

We can issue addresses to computers, many of which cannot be considered to be in a fixed place, yet somehow we can't issue a permanent, unique address to something that's not likely to move around much.

Re: Falsehoods programmers believe about addresses

#52

Is it common to believe that post codes don't start with zero? All of New England (ME, MA, NH, CT, RI, VT) have zero starting post codes. Plus apparently a part of New Jersey. Map here: http://en.wikipedia.org/wiki/ZIP_code Also, since it brought up naval vessels, here's the addresses of all US Navy ships: http://www.navy.mil/navydata/ships/lists/ship-fpo.asp Anyways, the post office does a wonderful job delivering m…

I got in to an argument in school with my computer programming teacher. A BASIC course, we were having to design a system to accept an address, and I was treating my ZIP code as a string.

IIRC, something like

50 INPUT "Your ZIP code?", ZIP$

Everything was reviewed via handwritten code and flowchart before we were allowed to type it in in the lab, and I was told "ZIP code is a number, but you're putting it in to a string, that's wrong, fix it".

"But a ZIP code starting with 0 would then not have the 0 at the front when we show it back to the user" I said.

"ZIP codes don't start with 0"

Me: "Some do"

Her: "No, they don't"

I lived in Michigan, but was a huge infocom fan, and they were in MA, and had a leading 0 in their ZIP code. We argued about this for a good few minutes, and it wasn't until I brought in something the next day that demonstrated legit ZIP codes starting with 0 that I 'won'. Crap like this reinforced my distrust of authority and cynicism in life (for better or worse).

EDIT: Anyone else remember the "New Zork Times" newsletter? :)

EDIT 2: It wasn't until much later that I learned the ZIP code system we had wasn't actually completely formed until after she was at least a teen, if not a full adult - she simply wasn't exposed to stuff that I was earlier, it didn't really impact her, and she just assumed they were all numbers with no leading 0s. In some ways a minor point, but... it also taught me about stuff I took for granted not always having been there, even something as basic as addresses. Didn't really learn that until much later after that class.

Re: Falsehoods programmers believe about addresses

#53

I read this article a long time ago and I took it seriously. So instead of asking for address, postal/zip code, city, state/province, I just put up a big text area labeled "Full address" so that people have complete freedom about what to fill in. 80% of the users ended up only filling in their street address, not their postal/zip code, city and state/province, even though they're from countries where (most?) addresse…

Indeed, I've been on the receiving end of somebody taking this kind advice to heart once, and things not working out too well.

At that job the we had a legal obligation to let anyone in the country to opt their building out from a certain database, by entering the address on a web form. We'd then send a snail mail verification code to that address, and enact the opt out on entry of the code.

This was covered incredibly well in the media, and the number requests was in the millions (don't know how many of those actually turned out to be valid). I suspect the people who'd made the web form had read this exact rant about addresses, since contrary to how things were normally done, they'd just put in a big textarea for the address. Now, this was completely unnecessary even by the standards of the "falsehoods" article, since it was a country with very well established address conventions, and since by definition no addresses from other countries should be entered. And as might be predicted, it caused some problems.

First, just as you note, people didn't really understand what they needed to enter into a textarea like that. They didn't do as bad a job as in your case, but you'd have things like people leaving out zip codes, leaving out the city, putting their name on the first line (even though the name had been asked for separately), entering all address components on the same line, entering addresses in different countries, and so on. And unfortunately the geocoding service used to let them check whether the address had been interpreted correctly (for the purpose of "this is the address that should be expunged from the db") was very good at finding the right location even with badly malformed addresses, and no other input validation was done. BTW, it's quite likely that without this geocoding step the amount of bizarrely formatted or just outright invalid addresses would have been higher.

More importantly, even ignoring the data quality issues, the services used sending out millions of letters in bulk would not accept free form addresses in general. No, they needed the address broken out in separate fields, exactly in the way they would have already been stored if we'd had the kind of structured input form that everyone uses.

My part of the story was then to clean up the mess, a task I got despite being in a totally different group, since I happened to work on the address extraction parts of the geocoder at the time. A disaster always takes precedence over real work :-/

Writing the code to do the right thing 99% of the time took a few days, and I don't want to know how much time was spent by someone manually on the remaining 1% that were flagged by the program. I somehow doubt that anywhere near as much time was saved on punting on the web form.

Re: Falsehoods programmers believe about addresses

#54
post #33

I read this article a long time ago and I took it seriously. So instead of asking for address, postal/zip code, city, state/province, I just put up a big text area labeled "Full address" so that people have complete freedom about what to fill in. 80% of the users ended up only filling in their street address, not their postal/zip code, city and state/province, even though they're from countries where (most?) addresse…

At least it helps if you don't block on empty fields then - I keep getting annoyed when sites demand I enter "state/province" for international shipping when my country doesn't have that concept. Or demand that I enter 6-digit postal code when we only use 4. Or not being able to handle non-ASCII chars. And things like that - helping people is fine and useful, but blocking a user because you set up assumptions valid o…

> I keep getting annoyed when sites demand I enter "state/province" for international shipping when my country doesn't have that concept.

And uses a select box of US states, so even if your country did have such a concept (and used it for mail, which may not be the case) you couldn't give it.

Re: Falsehoods programmers believe about addresses

#55

Earlier quoted context omitted.

I think the consensus is to go with the "big blob of text" approach. You mentioned that postal workers are the only people qualified to parse addresses—let them do it. The validation done on your end shouldn't be much more than asserting that addresses contains non-whitespace characters. I don't know how well this works in practice, but it's the most "correct" thing to do.

Bad mistake you get a metric fuck ton of shit in your data that way. You should always police your input data properly one big text field is lazy programming that leads to a big technical debt later on. And yes that does mean handling apostrophes and all those other edge cases properly.

Name of recipient, state/province/etc., postal code and country, maybe. But for the rest, that bit (at least in the UK) that goes in the middle... what policing can you do? That part is just a text blob. You can't do much meaningful with it except for showing it to somebody (e.g., on a label affixed to the package you're sending) and have them figure it out.

Re: Falsehoods programmers believe about addresses

#56

"An address will exist in the country's postal service's database" This is the one that I've run afoul of -- not because I live in a brand-new building, or a houseboat, or 30 miles from anywhere on an unnamed road; it's just that there is no door-to-door delivery for houses within a 2-block radius of the local post office, so we have a PO box. The trouble happens when a business that needs my street address uses the…

Related--the "commonly used" address is different from the "official" address. When I moved into my current house, it's official USPS address differed from what many of the local service people thought was the address (and, indeed, what many maps showed to be the address).

In these days of GPS--and just the passage of time--it's not a problem any longer. But for the first five years or so I lived in the house, I had to be careful to explain the situation to people coming to the house.

Re: Falsehoods programmers believe about addresses

#57

Patrick has an excellent variation on this theme: http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-b... I live on a road that has two sets of numbers, both identical (but several hundred meters removed from each other) in two different towns but with the same name. Getting mail and packages delivered here is for want of a better word a challenge.

Is it because the post sucks at its job? I would expect this to be handled correctly for the sole reason that you could have two unconnected roads with the same name in two different cities and end up in essentially the same situation, no?

Re: Falsehoods programmers believe about addresses

#58
post #10

There are so many misconceptions from developers, even more when building apps used worldwide. If you plan to accept data from different countries, free text with no validation is the only acceptable answer. I remember once we had to remove validation from names because some countries don't even have last names, and others have real names with two or even one characters.

I have a one-word name. It's my "legal," wallet-name. The only corporation/government/monoliths that address me with that one name is the department of licensing (my drivers license) and the State Department (my passport), both of which just show my one name.

I have to just make things up for one or the other field (first, last). Usually I go with my initial as my first name, and my name as my last name. Or my one name in both fields. I once signed up to some web service that I didn't care about with a last name of IHaveNoLastNameAndThisFieldIsTotallyMadeUp.

Re: Falsehoods programmers believe about addresses

#59

I read this article a long time ago and I took it seriously. So instead of asking for address, postal/zip code, city, state/province, I just put up a big text area labeled "Full address" so that people have complete freedom about what to fill in. 80% of the users ended up only filling in their street address, not their postal/zip code, city and state/province, even though they're from countries where (most?) addresse…

Did you try pre-filling the address field with an example address (John Doe, 123 Example Avenue, Hobbiton 1234) to make it clear what is required? (Although it seems like placeholder text only works with textarea fields since HTML5...)

Side by side examples would be better, because the example is still there for double checking after you've filled in the data. Pre-filled obliterates the example.

Re: Falsehoods programmers believe about addresses

#60

Is it common to believe that post codes don't start with zero? All of New England (ME, MA, NH, CT, RI, VT) have zero starting post codes. Plus apparently a part of New Jersey. Map here: http://en.wikipedia.org/wiki/ZIP_code Also, since it brought up naval vessels, here's the addresses of all US Navy ships: http://www.navy.mil/navydata/ships/lists/ship-fpo.asp Anyways, the post office does a wonderful job delivering m…

I got in to an argument in school with my computer programming teacher. A BASIC course, we were having to design a system to accept an address, and I was treating my ZIP code as a string. IIRC, something like 50 INPUT "Your ZIP code?", ZIP$ Everything was reviewed via handwritten code and flowchart before we were allowed to type it in in the lab, and I was told "ZIP code is a number, but you're putting it in to a str…

"I am the authority in these matters."

" Why?"

"Because I am in authority."

Post reply on HN