logoalt Hacker News

awesome_dudeyesterday at 5:22 AM1 replyview on HN

> Basically everyone in the US knows the first 5 digits. It's really easy to memorize them. If you can remember your city, you can remember your zip code. And in the US you use it all the time, so it stays memorized.

What's the 5 digits for Yonkers New York (edited because I originally had NYC)

> That complaint about magic numbers is completely off base. Magic strings are just as bad in software. "Beverly Hills" and 90210 are equal sins on the magic front.

For the same reasons, that's why it would be: Beverly Hills, Los Angelos County, California, USA, 90210


Replies

Dylan16807yesterday at 6:37 AM

> What's the 5 digits for Yonkers New York (edited because I originally had NYC)

Nobody sends packages where the destination is an entire city. If someone gives me an address inside Yonkers, it'll have the zip code in the address. I've never had to look up a zip code in my life.

> For the same reasons, that's why it would be: Beverly Hills, Los Angelos County, California, USA, 90210

Which reasons? That has nothing to do with magic numbers, except that a 'magic full mailing address' is still bad, you don't shove that into the middle of your code either. If you're looking at the "made a typo" reason then that's where showing the address after putting in the zip code will give you the same verification but faster.

show 1 reply