11 ms·
Falsehoods Programmers Believe About Phone Numbers
- CapitalistCartr 11y agoThis is much like Patrick's "Falsehoods Programmers Believe About Names". http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-b...
- greenyoda 11y agoAlso: Falsehoods programmers believe about time: http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time http://infiniteundo.com/post/25326999628/falsehoods-programm... More falsehoods programmers believe about time: http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time http://infiniteundo.com/post/25509354022/more-falsehoods-pro... Falsehoods programmers believe about geography: http://wiesmann.codiferes.net/wordpress/?p=15187 http://wiesmann.codiferes.net/wordpress/?p=15187 Falsehoods programmers believe about addresses: https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...
- pje 11y agoMy pet peeve: "falsehood lists" that see no reason to explain _why_ any of the falsehoods are false.
- deathanatos 11y agoA while back, when this came up on HN previously, I wasn't sure that all of them were actually falsehoods, so I went through each and listed reasoning for why I though they were or weren't: https://gist.github.com/thanatos/eee17100476a336a711e https://gist.github.com/thanatos/eee17100476a336a711e
- masterzora 11y agoA few explanations you can add for more-falsehoods.rst: > 15. Unix time is the number of seconds since Jan 1st 1970. The section you quote from Wikipedia shows why this one is false: leap seconds. Similar to how the number of hours between 00:00 and 3:00 in most of the United States depends on whether the timezone remains constant, springs forward, or falls back, the number of seconds between two Unix timestamps depends on how many leap seconds were inserted or deleted in that time frame. > 16. The day before Saturday is always Friday. This one is true only within the assumption but I'm not sure if the falsehood is literally false. When Alaska did the calendar change it had two consecutive Fridays (October 6th & 18th, 1867). This gives us the day after Friday not being Saturday but technically not the day before Saturday not being Friday. The falsehood still holds in spirit (outside of the assumption), of course, and it's possible somewhere else had it be true in practice as well. > 27. The weekend consists of Saturday and Sunday. The weekend differs across the world. Friday and Saturday is another popular one but Brunei gets a special shout out for having a Friday and Sunday "weekend" with Saturday being a working day. > 59. DST is always an advancement by 1 hour As far as I know, this is currently true if you aren't dealing with historical datetimes but Singapore will mess you up with historical data. They had a really odd case[1] where they went on DST by advancing 20 minutes and then ended DST without changing the clock at all. [1] http://www.timeanddate.com/time/zone/singapore/singapore?syear=1925 http://www.timeanddate.com/time/zone/singapore/singapore?sye...
- joncrocks 11y agoWikipedia suggests that there's an Australian island that still uses a half-hour DST. https://en.wikipedia.org/wiki/Daylight_saving_time#Procedure https://en.wikipedia.org/wiki/Daylight_saving_time#Procedure
- deleted 11y ago[deleted]
- jameslk 11y agoNice! I wish I had known about these articles before. I just created a repository to keep track of them: https://github.com/jameslk/awesome-falsehoods https://github.com/jameslk/awesome-falsehoods
- laut 11y agoAlso: Falsehoods programmers believe about time and time zones: http://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html http://www.creativedeletion.com/2015/01/28/falsehoods-progra...
- Bluestrike2 11y agoOh, god. It's like a perfect storm for a crippling epistemological dilemma. "Nothing can be known, not even this" about sums it up. I guess we're stuck with working from probabilities. Carneades would be proud.
- Marazan 11y agoThe point is not to include validation rules that will fail for well formed data.
- mikeash 11y agoGoing further, if at all possible, leave validation up to others. For example, don't validate delivery addresses at all if your shipping company has a validation API. If you must do validation yourself, put in the time to research it and get it right, don't just bang something out based on your own experience of the problem domain. Edit: one more: if you must validate, keep this separate from how you store the data, so you can more easily fix your mistakes or adapt to changes.
- patmcguire 11y agoWish the geography one had "terrain is consistent through time" The border is where the river used to be... total chaos now https://www.google.com/maps/place/Vicksburg,+MS/@32.1198292,-91.0866534,12.22z/data=!4m2!3m1!1s0x8628e027f6b111b9:0x77422a69074f7bc0 https://www.google.com/maps/place/Vicksburg,+MS/@32.1198292,...
- hobarrera 11y agoThere's a street in Buenos Aires with a name that translates to "17 of Novemeber 1894" (or some other year, not sure). So, not only does the street have a number, it has TWO. And your address ends up being: "17 of November 1894 230 3C" (we put building numbers after street names).
- jordigh 11y agoSo... what are we supposed to do? Every abstract model of reality has to make some simplifying assumption. Or should we curate some sort of general libraries that can handle all the exceptions to the rules if they are given enough context? Many of these libraries already exist. This is like trying to accept all valid email addresses according to the RFC. Even when we have a spec, there's a maddeningly complex array of possibilities, but it's ok if for almost everything we accept some subset of it. It would be madness, for example, if we forced government employees of a particular country to be able to deal with all possible scripts of the world, including Prince's symbol, just to account for all possible ways that humans name themselves.
- xenophonf 11y agoThis is remarkably easy if you aren't writing an MDA/MTA: Treat the email address like a blob. The only verification necessary, if any, is whether the user clicks the enrollment link or whatever.
- Zarel 11y agoA general list of Falsehoods Programmers Believe: http://spaceninja.com/2015/12/08/falsehoods-programmers-believe/ http://spaceninja.com/2015/12/08/falsehoods-programmers-beli...
- rodgerd 11y agoMost of these are fundamentally rooted in "That understanding how to issue instructions to a computer in some way correlates with high intelligence and excellent general knowledge."
- jleader 11y agoI think that's a bit harsh; it's more like "If you know how to issue instructions to a computer, you can derive anything else about the world from first principles."
- Zarel 11y agoAll I'm really getting is "everything has a lot more exceptions than you think". I don't think any of them about programmer hubris specifically. A lot of people could fail to realize that "23:59:60" is a valid time, for instance.
- alexvoda 11y agoIndeed. It's not that they apply only programmers. It's that programmers are the ones who have to deal with this mess.
- jakobloekke 11y agoI actually think these lists should be called "Falsehoods designers/PO's/etc. believe about x". As a programmer, you may have to neglect these complexities sometimes, even though you know about them and have made the case.
- baudehlo 11y agoAnother good example (and mostly perl specific but not really) is Tom Christiansen's post on Unicode in perl and other languages: https://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default https://stackoverflow.com/questions/6162484/why-does-modern-...
- Scoundreller 11y agoThe same could be said about addresses. I love printing out a Fedex shipping label on-line, and then seeing how it mangles French diacritics. Then I have to hope the package will make it to the right place. Sometimes these accents are disambiguating...
- jdavis703 11y agoThe way American (or maybe English speaking) companies handle diacritics is shameful... but don't postal codes serve as a kind of check against incorrect or ambiguous place names?
- liw 11y agohttps://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/ https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a... That documents that not all addresses have postal codes. This is another example of the real world existing in order to give programmers kicks in the head.
- realusername 11y agoPostal code in France is an effectively an area code (which can be quite large) so it does not help you to find the house/building, the main goal of it is to dispatch mail.
- Symbiote 11y agoThis annoys me, as I've had to deal with a lot of corrupted data. So when I moved from the UK to "København Ø" I experimented on all the change of address forms, for banks etc. Many could handle the characters, but where I sent a paper form the person entering the data didn't know how to type it. This must be a problem for somewhere like Armenia, where I have seen people really struggling with the English alphabet. Education was Armenian and Russian for a long time. (There are postcodes in Denmark, but Ø is the first letter of East, so is a very broad code, in a way.)
- patio11 11y agoI'm honestly modestly happy that people can now write these articles without namechecking me for starting the meme.
- realusername 11y agoCould we also add to this list "the first name comes always first ?", I expect my last name to be entered and displayed first.
- raverbashing 11y agoCurious, are you French, Chinese or from somewhere else?
- realusername 11y agoYes, French indeed, well-spotted ! I also enter the last name in capital case, that's part of writing it like this 1000s of times in school. By the way, for people reading this, from my own experience, at least 30/40% of French people will put the last name first in the form, whatever the text says, so to get better data, the best thing is to put them in the order (last name / first name) for them to reduce the number of errors.
- crgt 11y agoHungarian names also work like this.
- greenyoda 11y agoAnother way that a phone number may become invalid is that its area code can change. For example, if an area code runs out of assignable numbers, it can be split into two or more area codes and some numbers in the old area code will be assigned a new area code. Alternatively, new area codes can be overlaid on top of existing ones - in NYC, Manhattan has 212, 646 and 917. A phone number that's invalid one day can become valid the next day if a new area code is introduced.
- jcrawfordor 11y agoWhen I was a kid, Portland, Ore. outgrew area code 503 and was issued an overlay area code, 971. To try to prevent confusion, the phone provider, which I believe was still USWest at the time (later Qwest later CenturyLink) made the area code mandatory. All the sudden dialing the 7 digits on most advertisements got you a recording: "Ten digit dialing is now required in the Portland area..." Many years later, a friend borrowed my cellphone in an area where phone numbers were often dialed as seven digit. Not thinking about my being from out of state, he only dialed seven digits, and happened to get some rather confused person back in Portland. I had no idea my cellular carrier would even allow you to do that! So overlay area codes can combine with number portability to have some odd results. A number may or may not be considered valid by the carrier, and may or may not get you who you expected, and in edge cases this may depend on the carrier.
- f_allwein 11y agoAnother common falsehood would be "phone numbers everywhere are structured the same as in the US", e.g. with a three letter area code.
- OJFord 11y agoUgh, yes. Just from a UX perspective, I hate it when I enter my number and it's reformatted as I type into a strange (to me) looking arrangement due to this assumption.
- OJFord 11y agoUgh, yes. Just from a UX perspective, I hate it when I enter my number and it's reformatted as I type into a strange (to me) looking arrangement due to this assumption.
- Symbiote 11y agoOr the assumption that all numbers in a single country are formatted the same way. 020 1234 5678 London. 0121 123 4566 Birmingham. 01234 567 890 Some small town somewhere. 07987 654321 Mobile. (Is that right? Maybe a second space.)
- stordoff 11y agoYou also can't assume that the user knows how the number should be formatted/split. When Sheffield moved from six to seven digit numbers, '2' was prepended to all existing numbers, so 0114 XXX XXX became 0114 2XXX XXX. A fairly large number of people interpreted that as an area code change instead of a actual number change (see, e.g. [0]), and I still see signs giving business numbers formatted like "(01142 XXX XXX)". [0] http://www.thestar.co.uk/what-s-on/out-and-about/calling-sheffield-0114-3-1-290413 http://www.thestar.co.uk/what-s-on/out-and-about/calling-she...
- walshemj 11y agoI have always seen the uk non metropolitan addresses written as 01234 567890.
- j2kun 11y ago0. Every internet user has a phone number they can be reached at.
- guessbest 11y agoYou'd think Programmers would start counting at zero. But seriously, this is more about the limitation of POTS, Plain Old Telephone Systems.
- gaur 11y agoThe bandwidth of POTS is limited to about one decade, from 300 Hz to 3.3 kHz. Often you don't notice the poor quality while using POTS. But if you ever listen to an NPR show where a journalist is calling into the studio over POTS, it's quite jarring how bad it is.
- david-given 11y agoThis is my pet hate. There are too many places which require a phone number and won't take no for an answer. Some of them you can lie to, entering something that's obviously invalid like 0, but others do rigourous validation and simply won't let you enter something that's not a phone number (Google Play is an offender here). I usually end up entering 012345678, but that's actually a valid UK number, and I don't like doing that. But you have to wonder about any online form which requires you to lie to complete...
- jessaustin 11y agoIn North America, I've always used "<valid area code>-555-1212", which is one of the numbers for directory assistance. The area code may be varied based on whatever location seems plausible. Unless the service insists on sending a text or verifying the number with your credit card company (the latter seems less common now than it used to be) there are no problems. I wouldn't worry about "012345678"; if they didn't want that number they'd probably have changed it by now. Maybe they want "867-5309"?
- 11y ago
- aexaey 11y agoNot exactly a falsehood, but certainly a quirk: In general, in Europe "0" is national dialing prefix, leading to numbers written in the format of: +44(0)870123456, meaning dial 0870123456 from within the UK, and +44870123456 internationally to reach the same number (i.e. "0" goes away in international format). However in Italy, leading "0" in the national dialing format is an integral part of the phone number itself (only for non-mobile numbers); for example: (+39)051234567 meaning 051234567 when dialing from within IT, and +39051234567 internationally (i.e. "0" stays in international format). EDIT: Mobile numbers in Italy don't have leading "0", and could only be dialed in full/international format either within the country, or internationally.
- Symbiote 11y agoI think the +4412345... form, or +39012345... work in all situations. But, outside small countries many people will be unfamiliar with a number in this format.
- rwmj 11y agoAdditionally some people believe that dialing a +XX, or even regional number will cost more even if they are in the same country/region. Which, at least in the UK, at least with common service providers, is not true.
- Nullabillity 11y ago> In general, in Europe "0" is national dialing prefix, leading to numbers written in the format of: In parts of Europe. Denmark has no area codes at all.
- deleted 11y ago[deleted]
- EGreg 11y agoAt least the main part of phone numbers is true: they are scarce, which makes them the main way to prevent sybil attacks. Facebook accounts are a distant second. Throwaway emails make sybil attacks very common on sites that let you sign up with an email. https://www.technologyslegaledge.com/2014/04/telephone-numbers-an-infinitely-available-scarce-resource/ https://www.technologyslegaledge.com/2014/04/telephone-numbe... Does anyone know of any other easily verifiable resource which is on average available to very nearly one per person?
- tshtf 11y agoPhone numbers in most countries are definitely not scarce. US numbers can be obtained in virtually any area code (excluding 212 and a few more) from between $0.40 and $1.00/month. There are even services that provide temporary throw-away numbers.
- EGreg 11y agoYes but you are ignoring the overall picture. If you factor in all those numbers that can be obtained, it is still de facto close to 1 number per person on average. We are talking about numbers for which an SMS can be successfully delivered and the end-user gets some unique code. You'll find all of those "throwaway" SMS services re-use the same numbers, because they are scarce. I challenge you to produce any country (link supporting what you say) where phone numbers with SMS DELIVERABILITY are not scarce eg dont need a device or endpoint to be registered with some carrier or can be obtained by the hundreds.
- tshtf 11y agoUS and UK numbers with deliverable SMS are under $0.40/month each, and can be ordered in bulk for virtually any area code through many providers such as: http://www.anveodirect.com/prices/did http://www.anveodirect.com/prices/did
- kuschku 11y agoYou realize in Germany I can add a suffix to my number, and if registered properly, it will still dial me? I could dial 0431 4242 1234, or 0431 4242 1235, and they'd refer to the same account. In fact, many business lines allow you infinite suffixes. 0431 4242 123456789 is a possibility. All with SMS deliverability (SMS delivered to non-SMS numbers are transmitted via text-to-speech).
- thinkpad20 11y agoI find the title of this article condescending. The falsehoods given in this list are surely not believed by all programmers (much less the ones who need to work with phone numbers), and moreover I'm sure belief in them is not exclusive to programmers. I might be off-base in this criticism, but to me starting off with "let me show you how you're wrong" is not the best way to engage your readership. Perhaps a better title would be "common misconceptions about phone numbers" or "things to keep in mind when programming with phone numbers".
- Swizec 11y agoRelax, it's a nod to a famous article. You could call it a genre by now: Falsehoods programmers believe about X. Links in other comments.
- csydas 11y agoI can appreciate that it is an aggressive (arguably clickbait) title and can be off-putting, I think the reason there's a focus on programmers is because most other professions will not need to ever know or consider most of these facts about phones ever. The focus on programmers is because virtually every point is about handling phone numbers as data to be processed and worked with, which is a fairly unique perspective that, as far as I can think, only programmers have. Most of the points are pitfalls that might trip up a programmer when working with code that takes a phone number as an input and needs to validate it. While I'll grant that your alternative titles are much less aggressive, the original title really isn't condescending unless you read into it as such, in my opinion. It doesn't say "all programmers", just programmers, and all points seem like fairly common misperceptions.
- c3534l 11y agoIt would probably be more accurate if it were titled "Common Assumptions Programmers Often Mistakenly Make." But, meh, the actual article was not very condescending.
- tomschlick 11y agoIt's just easier to treat phone numbers as a 100 character string in your DB. For validation & formatting, I have just sent it through Twilio's loookup api (which i believe is powered by google's libphonenumber).
- OJFord 11y agoI was scrolling through, feeling largely unsurprised, when: 14. In Israel, certain advertising numbers start with a *. Woah! Definitely didn't see that coming; I can certainly imagine my( prior )self storing/passing phone numbers as some integer type. But along with another user's comment that in Italy, leading zeroes are required, it's clear that (at least in any international application) phone numbers need to be strings.
- noselasd 11y agoIf you store phone numbers as integers (you normally should not), remember that leading zeroes are significant. 0123 is not the same as 123. But as integers they normally are (And make sure your parser doesn't parse 0123 as octal).
- jdavis703 11y agoAlso my U.S. phone number used to be 703-6XX-XXXX (digits omitted for privacy). That's not going to work if you store it as a 32-bit integer (when I was a dumb college student I made a similar mistake, and spent a couple of minutes scratching my head over why my number kept changing to 214-748-3647 every time I saved it to the DB).
- raw_creations 11y ago"Somewhere in Dallas, some poor bastard is wondering why his phone rings off the hook with calls for the Nevada Division of Mental Health & Developmental Services, the Jackson County Florida Chamber of Commerce, a yacht club in New York….." And NASA, apparently http://sbir.gsfc.nasa.gov/award_firm_list/selection_nid/35136 http://sbir.gsfc.nasa.gov/award_firm_list/selection_nid/3513...
- OJFord 11y agoI said 'some integer type' in anticipation of this comment if I'd just said int ;) Although, the other reason that won't work (which I thought you were going to say) is that it'll end up as -X1XX!
- 11y ago
- baudehlo 11y agoIt's a shame despite the title there were no tips for using libphonenumber in the article. It's a very finicky library. You have to clean your inputs a lot before using it.
- lucaspiller 11y agoThere are also a lot of edge cases where I've found it doesn't work. Phone numbers change all the time, so if you are using this library you need to update it constantly, and even then it may still be outdated for new changes. If I need to validate a phone number is correct I'll send an SMS and ask the user to enter a code, otherwise I'll assume they know their phone number better than me.
- mratzloff 11y agoUnless it's a landline...
- shifte 11y ago> A phone number uniquely identifies an individual As someone who travels a lot I can attest to the annoyance of messaging apps which identify users by phone number. WhatsApp is a good example. Another terrible design is one time passcodes which are sent over SMS. When a number gets recycled it can become impossible to recover access to a service which you forgot was associated with the number you had at the time of signing up in another country.
- Scoundreller 11y agoI have a toll-free 1-8xx number. Since I often change cell phone numbers because I move frequently (nationwide free long-distance has never caught on in Canada), I like having one number I can re-direct as needed. When I go overseas and buy a local SIM card, I'll re-direct it to that so I can keep in touch. Telecoms have said they can't take it. The government tax agency can't accept it. Banks won't accept it. Now when I call in and they ask what my phone number is to verify my identity, I have to rhyme off a string of old phone numbers.
- nbb 11y agoWait, all of your phone numbers rhyme?
- nommm-nommm 11y ago"rhyme off" is an idiom. It means to recite a list of items.
- Kliment 11y agoPresumably derived from medieval mnemonic texts, which used rhyme as a method for memorizing large bodies of text.
- kobayashi 11y agoI wouldn't say that nationwide free long-distance hasn't caught on. It seems like most plans from the big three telecom companies now (and have for the past few years) included Canada-wide calling. That's just my anecdotal experience, though.
- justincormack 11y agoThat makes it difficult to call internationally - it is often impossible to call locally free numbers internationally
- Scoundreller 11y agoAs a Canadian, where postal costs have a space in the middle, I love how forms will reject them because I included the space, or failed to include it. With all the code they wrote to generate that pop-up, you'd think they could massage my input into the format they wanted in the first place...
- markdown 11y agoDo you mean postal (aka zip) codes? There any many countries without postal codes at all, and we have to enter fake numbers to validate forms. https://gist.github.com/kennwilson/3902548 https://gist.github.com/kennwilson/3902548
- jordigh 11y ago> postal (aka zip) codes Post codes aren't quite the same thing as Zone Improvement Plan codes. ZIP codes are just the peculiar implementation in the US of the general post code concept. An important difference between ZIP codes and Canadian post codes is that, since there are many more possible post codes than ZIP codes, post codes tend to cover much smaller regions than ZIP codes. In many cases, only a handful of individuals up to a single individual may have a Canadian post code. Thus, publishing Canadian users' post codes can severely harm Canadians' privacy, as you may as well be publishing their exact address.
- greenyoda 11y ago9-digit ZIP codes in the U.S. can also cover very small areas. For example, a large building could have its own 9-digit ZIP code.
- greenyoda 11y agoSimilarly with credit card numbers: most credit cards have spaces between groups of digits in the account number (as it appears on the card), but many web forms will reject the number if it has spaces in it. (I find it much easier to verify that the number I typed into the form is correct if it looks like the number on my card.) Or web forms will reject a phone number if it has non-numeric characters like "-", which many people would probably think of as an integral part of their number.
- klagermkii 11y agoAn issue I don't see raised here is the complications from Mobile Number Portability, where one may use different services to send text messages to different networks in a country and wrongly rely on the number prefix to identify the mobile operator.
- zhemao 11y ago> phones in the disputed territory and partially recognised state of Kosovo may be reached by dialing the country calling code for Serbia (+381), Slovenia (+386), or Monaco (+377) Monaco? WTF? And Slovenia doesn't make much sense either. Why wouldn't it be Serbia and Albania?
- izacus 11y agoFor Slovenia it's because the largest operator Mobitel (now part of Telecom of Slovenia) had a rather large mobile base station and service deployment in the region. The base stations were directly managed from Slovenia even before the split and were now assigned the slovenian prefix.
- nommm-nommm 11y agoI wondered about this too. It appears to be because one of their mobile phone service provider's network is managed by Monaco Telecom. https://en.wikipedia.org/wiki/Post_and_Telecom_of_Kosovo https://en.wikipedia.org/wiki/Post_and_Telecom_of_Kosovo
- phillc73 11y agoI wondered too, and thought perhaps they meant Montenegro (+382), which is right next door to Kosovo. Apparently not.
- geekfactor 11y agoJust ran into this the other day. A popular ride sharing app has a huge security hole wherein if you get a recycled mobile number you can easily gain access to the account details of the previous owner of the number and run up a bill on their credit card.
- byroot 11y agoAbout 2 years ago I got a new number and I started receiving facebook notifications from the previous owner as SMS with autologin links in them.
- ajmurmann 11y agoA related falsehood that is built into many systems is the believe that zip codes don't change and that new ones won't be created. A co-workers area got a new zip code resulting in many months without properly working health insurance because computer systems kept flashing his zip code as invalid despite the new zip having been issued years ago.
- contingencies 11y ago1. Phone numbers that are valid today will always be valid. Phone numbers of a certain type today (e.g., mobile) will never be reassigned to another type. [...] Tip: Don’t store properties for a phone number such as validity or type. Check this information again from the library when you need it. Not sure this suggestion is a truly pragmatic approach, because there is often very little else to determine SMS reachability up front, which is a common want. One might assume mobile until an adequately reliable SMS provider determines that the number is in fact not a mobile reachable SMSC-managed number. Fun fact: in China, there used to be multiple mobile messaging systems including a non-SMS system with weird gateway restrictions and no UCS-2 Unicode support. Another fun fact: UCS-2 kills bytes rapidly, you are better off (ie. get more length per message) using legacy local encodings like TIS in Thailand, etc. from a cost/length perspective. If you want to achieve that today, almost no mobile messaging provider can help you, you need to build custom SMS PDUs through their binary PDU submission interface, which is documented but still something of a black art and typically has very different reachability constraints to standard messaging (whole operators may suddenly become inaccessible). 2. A phone number uniquely identifies an individual [...] It wasn't even that long ago that mobile phones didn't exist, and it was common for an entire household to share one fixed-line telephone number. In some parts of the world, this is still true, and relatives (or even friends) share a single phone number. This may be true, but on a related note, it is the trend now in many countries to require formal government identity document submission in order to obtain a SIM or make it functional through user registration. Therefore, in some parts of the world, you can skip a whole lot of mucking around with mobile-connected services by re-evaluating the probable bad-actor risk metric for customers from those countries through considering probably relatively strong police identification efficacy of abusive accounts in these markets. 3. An individual has only one phone number. [...] Obviously, this isn't necessarily true. An individual has zero or more numbers which are not necessarily unique to that user, long term accessible, or of any certain or constant type or origin. Someone else may take these over at any time, so they cannot be relied upon solely as a trusted channel to the user. 5. Each country calling code corresponds to exactly one country [...] The USA, Canada, and several Caribbean islands share the country calling code +1. Russia and Kazakhstan share +7. This is only half true. They generally have longer prefixes. For example https://en.wikipedia.org/wiki/Khazakstan https://en.wikipedia.org/wiki/Khazakstan shows +7-6xx, +7-7xx and much of the +1's can probably be reliably split through prefixes. 6. Each country has only one country calling code Further example: calling Taiwan via China. Another point: some endpoints need PABX suffixes to reach, for example voicemail or via corporate systems. There is no real standard for these programs, which tend to incorporate functions like "wait for initial connection", wait x seconds", "wait for a sound", or "wait for a second dialtone". In some countries people will write 123456 x7 for extension 7, but often multi-level inputs may be required (classic case: almost any telephone-based customer support system), in which case there is no standard. Finally, I was inspired by this document to write a similar one about International Bank Account Numbers (IBAN), see https://news.ycombinator.com/item?id=11321785 https://news.ycombinator.com/item?id=11321785
- ryandrake 11y agoI've always loved the "Falsehoods Programmers Believe About Xxxx" articles. There's always that junior developer who says, "We need a Xxxx handler! That's easy, I'll write it myself in an hour!" (where Xxxx is either a time, address, name, etc., something with a huge number of tricky potential edge cases). You can just watch the bugs jump into the program as he types. Then you get to testing: Me: Try this test. Dev: Oh, didn't think about that one, let's add that case. Me: How about this? Dev: What? OK OK, let's support that too. Me: And this one...? Dev: Wait, what? How is that even...? The code is about 200 lines now, and we've blown the afternoon, and it still doesn't properly handle Xxxx, so I'll forward him the "Falsehoods Programmers Believe About Xxxx" article. Dev: Oh crap, maybe I should have looked for a tried and true library that handles Xxxx.... Me: Yes, grasshopper...
- gbin 11y agoBottom line: phone numbers are really bad identifiers !
- alexvoda 11y agoYup, along with addresses, names, other identifiers and combinations of the above. To the irritation of those wanting to use natural keys.
- elcapitan 11y agoThose falsehoods looked less problematic than the prior ones about names and addresses. Maybe because phone numbers still are technical things, numeric, and less culturally coded over hundreds and thousands of years.
- eru 11y agoHow about `everyone has a phone number'?
- deleted 11y ago[deleted]
- dyates 11y agoI remember being greatly annoyed at a version of Google Hangouts that would pop up a message about certain phone numbers being too long whenever I opened SMSs from them, and then flat-out refuse to let me reply to them. In South Africa, we have a lot of SMS services that tack five or so digits onto the ends of normal numbers as unique identifiers, so what I assume was a programmer's false belief about phone numbers did some real harm there.
- rwmj 11y ago> "Phone numbers are always written in ASCII" This one got me when I ran a Japanese website. Unicode (deriving from Japanese standards) has "fullwidth forms" for Roman letters and numbers. Thus your users can enter a phone number as 0123456789 or 0123456789 (or even a mixture), and your code had better be able to cope with it.
- alister 11y ago> In Brazil, to dial numbers internally but across a certain geographical boundary, a carrier code must be explicitly dialed to say which carrier you will use to pay for the call. Any Brazilians here who can confirm whether this is true? I know that in Brazil you can select a preferred carrier for a long-distance phone call by dialing a prefix. For example, you'd dial 014 ahead of your phone number to choose Brasil Telecom or 021 to choose Claro. But this is optional as far as I know. If you don't dial any prefix, you get a default carrier.
- kazinator 11y ago> ITU says things like "national numbers can not be longer than sixteen digits" but valid numbers in Germany have been assigned that are longer than this. German doesn't really have long phone numbers. Those are just phone number phrases made of individual small phone numbers, but strung together by the German writing system. :)
- JshWright 11y agoIf you're dealing with phone numbers, always normalize to E.164. It doesn't solve every problem, but it does a pretty good job of consolidating phone number issues to one place in your code (namely, the place where the E.164 normalization occurs). If you're dealing with short codes or other highly regional things... Good luck...
- jloughry 11y agoYears ago, North American area codes always had a middle digit of 0 or 1. This led to the practice of storing a phone number efficiently in 32 bits by swapping the first and second digits. It yielded a value that would fit in a 32-bit integer; for example, (912) 350-8000 became 1923508000. This method broke in 1995.
- nickpsecurity 11y agoLove articles like this. Learned some surprising things from it. Thanks to greenyoda for the others.