But What If We Run Out of Guids?
There was a bit of programmer humor happening on Twitter today concerning GUIDs.
Sadly, this is only funny because every programmer has inevitably had a conversation that went something like this:
Boss: "We need to make sure these entries are unique."
Dev: "No problem, we can use a GUID."
Boss: "But we are going to be creating millions and millions of these things. What happens if there is a collison?"
Dev: "I don't think it will be a problem."
Boss: "But these are going to be used on the web. What if somebody guesses a valid GUID?"
Dev: "They won't be able to guess, and besides, we will be checking security anyway."
Boss: "I'm just not convinced, I think we should..."At this point, the boss (or other offending party) usually comes up with some cockamamie idea that takes way too much time to implement, and is not guaranteed to be unique.
There's Not That Many Stars Anyway
But I recognize that phrases like "mathematically impossible", "2122", and "a trillion times more than the number of stars in the uinverse" are abstract and difficult concepts for business minded folks. So, for the non-anylitical types. I'm going to let you in on the joke, and attempt to show you why we programmers just stare at you blankly when you reject mathematically sound advice.
A GUID is like a really, really big number. How big? 2122 or 5.3×1036
Umm... So What?
So what does that actually mean? Let's pretend for a minute we had every single person on the earth generate a GUID every second for one year. 7,000,000,000 ppl * 86400 seconds in a day * 365 days in a year
Exactly how many GUIDs is that? 220,752,000,000,000,000
It Might Take A Day or Two
Ok, that's pretty impressive, but what percentage of the total number of possible GUIDs is that?
That doesn't look too good on a PowerPoint slide though, so how long would it take us to get to just 1% of all possible GUIDs?
I Have Underwear That Old!
Great news! It will only take us a measly 2.4 Quintilian years to completely exhaust 1% of all possible GUIDs if every person on earth spends every second of every day generating them!
If you are a developer and you are faced with this conversation in the future, then just pull up this article and show it to the mathematically challenged.