Magic GUIDs


  • Considered Harmful

    I found this gem in the documentation for the new content management system my company is migrating to:

    Select nodes with given relationship with given node.
    If you use 00000000-0000-0000-0000-000000000000 value, the relationships are not applied.
    If you use 11111111-1111-1111-1111-111111111111 value, the current node NodeGUID value is used automatically.

    That's right. Magic GUIDs!

    It's littered with various minor WTFs; but they don't begin to compare to our previous CMS, which was one giant, living, breathing WTF worthy of its own front page entry.

    But that's another story...



  • Magic GUIDs in themselves are no problem, as long as you generate a new GUID for every purpose.  They are supposed to be unique, after all.  You can generate one and use it as a magic CLSID, knowing that no class will ever have that GUID for a CLSID.  You can use them to represent concepts or to Gödel-number everything in the universe.

    The hard part is convincing your manager that 9E1C85DE-AE96-4072-B1CE-F20CE5618CA1 is unique in all the world, but 00000000-0000-0000-0000-000000000000 may not be.  The latter just LOOKS unique!  The former doesn't look unique at all.

    Oh, yes, and my favorite prime number is 57.  Well, it certainly LOOKS prime, doesn't it?

     


  • Considered Harmful

    11111111-1111-1111-1111-111111111111 certainly doesn't look generated.  If people can just generate them by hand, they're likely to pick non-random values, which then are unlikely to be unique.  Isn't the point of GUIDs to avoid collisions between separately generated sets of data?

    Not to mention users of this content management system are supposed to remember this silly rule-of-thumb.

    This being a web app and all, I'd like to see a way to avoid entering a GUID at all when it's not applicable.  They should have used some radio buttons or some such.  Or, even better still, show the user a list of meaningful names!



  • I've been subconciously dropping the D from GUID while reading this thread.  I was a bit confused for a minute there.



  • So who here pronounces it "goo-id" (in your head or out loud), and who says "Gee You Eye Dee" every time?

    Just wondering what the consensus of opinion is... 


  • Considered Harmful

    I've always thought that "goo-id" sounds silly.  I usually say each letter individually, but occasionally I find "gwid" easier on my tongue.



  • Maybe it should be pronounced like "Guido" without the o.

     



  • At my job we pronounce it like "squid".

    And I suppose the GUID with all 1's technically could be randomly generated. It's just not very likely. Well, I guess if you think about it, it's as likely as any other value.


  • Considered Harmful

    Actually, it's virtually impossible with the Microsoft GUID generation algorithm (and that's likely the one being used by this CMS, considering it's written in ASP.NET).

    It would either contain a MAC address (V1), or a '4' (V2).



  • [quote user="teedyay"]

    So who here pronounces it "goo-id" (in your head or out loud), and who says "Gee You Eye Dee" every time?

    Just wondering what the consensus of opinion is... 

    [/quote]


    I call them UUIDs.  Besides, being universally unique is better than being globally unique, isn't it?

  • Considered Harmful

    [quote user="newfweiler"]

    Magic GUIDs in themselves are no problem, as long as you generate a new GUID for every purpose.  They are supposed to be unique, after all.  You can generate one and use it as a magic CLSID, knowing that no class will ever have that GUID for a CLSID.  You can use them to represent concepts or to Gödel-number everything in the universe.

    The hard part is convincing your manager that 9E1C85DE-AE96-4072-B1CE-F20CE5618CA1 is unique in all the world, but 00000000-0000-0000-0000-000000000000 may not be.  The latter just LOOKS unique!  The former doesn't look unique at all.

    Oh, yes, and my favorite prime number is 57.  Well, it certainly LOOKS prime, doesn't it?

    [/quote]

    Maybe I'm missing the <irony /> tags, but don't you have your latters and formers reversed?



  • [quote user="joe.edwards@imaginuity.com"][quote user="newfweiler"]

    Magic GUIDs in themselves are no problem, as long as you generate a new GUID for every purpose.  They are supposed to be unique, after all.  You can generate one and use it as a magic CLSID, knowing that no class will ever have that GUID for a CLSID.  You can use them to represent concepts or to Gödel-number everything in the universe.

    The hard part is convincing your manager that 9E1C85DE-AE96-4072-B1CE-F20CE5618CA1 is unique in all the world, but 00000000-0000-0000-0000-000000000000 may not be.  The latter just LOOKS unique!  The former doesn't look unique at all.

    Oh, yes, and my favorite prime number is 57.  Well, it certainly LOOKS prime, doesn't it?

    [/quote]

    Maybe I'm missing the <irony /> tags, but don't you have your latters and formers reversed?

    [/quote]

    The last sentence about 57 being prime should have the irony tag.  As for looking unique, 9E1C85DE-AE96-4072-B1CE-F20CE5618CA1 looks a lot like 9E1C85DE-AE96-4072-B1CF-F20CE5618CA1 and 9E1C85DE-AE96-4072-B1CE-420CE5618CA1.  But 00000000-0000-0000-0000-000000000000 looks like no other GUID.

    People who do not know mathematics or programming use a slightly different definition for the word "unique."  As with "perfect" and "equal" and "random", it has degrees.  <ironyIntended>"Some animals are more equal than others."</ironyIntended>  <noIronyIntended>"We the People of the United States of America, in order to form a more perfect Union...."</noIronyIntended>  Each of the Bush twins is unique, but there are two of them, so neither of them is as unique as Caroline Kennedy.  So the all-zero GUID is (or looks) more unique (and less random) than a GUID that looks just like all the others.

     

     


Log in to reply