News for hackers. Stuff that matters.
Re:Falsehoods Programmers Believe About Phone Numbers by greenyoda on Saturday March 19, 2016 @09:20PM (#11321338)
Also:

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-pro...

Falsehoods programmers believe about geography:

http://wiesmann.codiferes.net/wordpress/?p=15187

Falsehoods programmers believe about addresses:

https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...

Re:Falsehoods Programmers Believe About Phone Numbers by jameslk on Saturday March 19, 2016 @11:01PM (#11321601)
Nice! 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
Re:Falsehoods Programmers Believe About Phone Numbers by Rafert on Sunday March 20, 2016 @07:56AM (#11322625)
Shouldn't that be 'A curated list of awesome falsehoods'? ;)
Re:Falsehoods Programmers Believe About Phone Numbers by jameslk on Sunday March 20, 2016 @11:21AM (#11323254)
Indeed :) I updated it and made it a bit more specific: "A curated list of awesome falsehoods programmers believe."
Re:Falsehoods Programmers Believe About Phone Numbers by patmcguire on Sunday March 20, 2016 @03:48AM (#11322176)
Wish 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,...

Re:Falsehoods Programmers Believe About Phone Numbers by pje on Saturday March 19, 2016 @10:46PM (#11321560)
My pet peeve: "falsehood lists" that see no reason to explain _why_ any of the falsehoods are false.
Re:Falsehoods Programmers Believe About Phone Numbers by deathanatos on Sunday March 20, 2016 @12:44AM (#11321849)
A 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

Re:Falsehoods Programmers Believe About Phone Numbers by masterzora on Sunday March 20, 2016 @04:53AM (#11322288)
A 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?sye...

Re:Falsehoods Programmers Believe About Phone Numbers by joncrocks on Sunday March 20, 2016 @07:45AM (#11322597)
Wikipedia suggests that there's an Australian island that still uses a half-hour DST.

https://en.wikipedia.org/wiki/Daylight_saving_time#Procedure

Re:Falsehoods Programmers Believe About Phone Numbers by hobarrera on Sunday March 20, 2016 @09:04AM (#11322750)
There'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).

Re:Falsehoods Programmers Believe About Phone Numbers by Bluestrike2 on Sunday March 20, 2016 @02:46AM (#11322063)
Oh, 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.
Re:Falsehoods Programmers Believe About Phone Numbers by Marazan on Sunday March 20, 2016 @05:10AM (#11322325)
The point is not to include validation rules that will fail for well formed data.
Re:Falsehoods Programmers Believe About Phone Numbers by mikeash on Sunday March 20, 2016 @01:33PM (#11323772)
Going 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.

Re:Falsehoods Programmers Believe About Phone Numbers by jordigh on Sunday March 20, 2016 @10:22AM (#11323003)
So... 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.

Re:Falsehoods Programmers Believe About Phone Numbers by xenophonf on Sunday March 20, 2016 @11:24AM (#11323267)
This 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.
Re:Falsehoods Programmers Believe About Phone Numbers by laut on Saturday March 19, 2016 @11:49PM (#11321706)
Also: Falsehoods programmers believe about time and time zones:

http://www.creativedeletion.com/2015/01/28/falsehoods-progra...