There's such a thing as a GUID. It's a very large number, generated at random. Here's one: "3F2504E0-4F89-11D3-9A0C-0305E82C3301". Isn't it pretty?
GUID stands for "Globally Unique Identifier". The idea being that that number will only ever be generated once. But, of course, it is random. It's just vanishingly improbable that it'll be generated more than once.
Now, you've probably seen these before. If you've ever looked at the Windows registry, it's full of them. A few, mostly ASP.NET, websites take them as parameters in URL queries (there's a blogging platform that does this); this is of course a great aid to that variety of web developer who believes in making dynamic URLs as long, incomprehensible and ugly as possible.
They're useful for all sorts of reasons. For example, you can merge two database tables with the same schema if their primary keys are GUIDs, say; after all, they're 'unique'. Because they're useful, they're increasingly used, especially in .NET land.
And yet, I wonder. Sure, it's incredibly unlikely that a collision will occur in any real-world system. But what would happen if it did? Might your parking ticket get turned into a regicide on your criminal record? Might your bank suddenly think that you owe the National Debt of South Africa? Might the local nuclear power plant next door suddenly load enough fuel rods for the next eight centuries? Are systems designed with GUIDs even prepared for this (remote) eventuality?
*shudders*
Yeah, I've always found them deeply unsettling.
ReplyDeleteI've often thought about GUIDs - sure they can never be guarenteed to be universally unique unless there was some kind of central database that leased them out in some manner...
ReplyDeleteI guess they are assumed to only be "globally" unique within local contraints.
Marky.