GUID – “GooID – not Gee You ID” – a unique identifier. There is often debate on the uniqueness of GUID’s. Microsoft uses them for a ton of things. CLSID’s in the registry, uniqueidentifer fields in SQL, and just anything unique. Microsoft isn’t the only one to use them, Oracle, Novell, etc use them.
As far as the uniqueness of GUID’s, here is what I found on Wikipedia:
“While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.40282366Ã—1038) is so large that the probability of the same number being generated twice is very small. For an application using 10 billion random GUIDs, the probability of one or more overlaps is on the order of 1 in a quintillion.”
A quintillion is 1018
That is alot :) since scientists estimate that there are about 70 sextillion stars in the sky, lets just say that the number of GUIDs is close to a duodecillion – which is more than the sextillion (if I have my large number names correct)
Those numbers alone should end any debate on duplicate GUID’s occurring in the wild, unless you are doing something really wacky to generate them. Some say that because in V1 of the algorithm, the MAC address was used as a basis for the last 4 digits, that you could get duplicates. I think that is still hard to believe that you would get dupes, since it was just the last 4 digits and it just didn’t use MAC address, it also uses time. So two computers with the same MAC address would have to create a GUID at the same nano-second. And even if that did happen, it would have to be a GUID used in the same application to have any adverse effects.
One problem with GUID’s, which usually happens because of sample code on the net, is that people use the sample code that has a GUID hard coded, and then reuse it in their application, which then can end up with duplicates on user’s computers. Browser Helper Objects, Explorer Shell Hooks, etc use GUID’s. Any DLL you want to register (COM for instance) is going to create a GUID when registered. It is always a good idea to create a new GUID when deploying any code that would use it. Visual Studio has a utility built right in on the tools menu to create GUID’s for you.
Basically, every developer should know what GUID’s are, and how they can be used, and how to created them. It is something that you should be able to talk about with colleagues and have no questions on the creation, use or uniqueness, or how to pronounce it :)