Comment On Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

There are those who believe that the GUID is the greatest innovation in information technology since twos-compliment, using them to identify everything from cars to invoices to llama. Then there are those who have to work with and maintain systems built by the wish-I-chould-change-my-name-to-a-GUID type. Perry Pederson falls in the later camp and gets to work with code like this ... [expand full text]
« PrevPage 1 | Page 2Next »

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:07 • by tag
I love how I can recognize anything MS related or code written by MS
programmers because their method and programme names always begin with
upper case letters.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:13 • by Brendan Kidwell
36800 in reply to 36796
"Always," you say... Hmm, isn't consistency one of the keys to code
readability? So what's wrong with them doing it that way if they're
consistent about it?

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:14 • by travisowens
36801 in reply to 36796

tag:
I love how I can recognize anything MS related or code written by MS programmers because their method and programme names always begin with upper case letters.


 


Now you've just typed a WTF as CamelCase is the preferred coding standard of Object Orientated Languages.... Java coders will (and should) type their method names the same way.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:17 • by Marty Thompson
36803 in reply to 36796
I always find UpperCamelCase to be easier to read.



And IIRC, Java's coding standard is lowerCamelCase on method names.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:18 • by Javier G. Lozano

And just think, this could be just the tip of the iceberg...[:S]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:26 • by loneprogrammer
But see, this is extensible!  If you ever need more than 32 bits for orderId, just start using more bits in the GUID!



Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:47 • by Diego Mijelshon
I think most of you are missing the point here.

The PascalCase for classes/members is the .NET standard, the same way
camelCase is the Java standard (the parameters, though, should be in
camelCase, which doesn't happen in the second method).



The WTF is that this guy is SO Guid-oriented, he feels he need to convert everything to a Guid, even when it doesn't make any sense.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:49 • by tag
36807 in reply to 36801
travisowens:

tag:
I love how I can
recognize anything MS related or code written by MS programmers because
their method and programme names always begin with upper case letters.


 


Now you've just typed a WTF as CamelCase is the preferred coding
standard of Object Orientated Languages.... Java coders will (and
should) type their method names the same way.





Funny, in the past 9 years working with open source software I've seen
many, many ClassNames, and almost zero MethodNames in CamelCase. 
And in the past 3 months working in software on the MS platform, I've
seen so much CamelCase and sHungarianNotation that I feel like my head
is going to spin.



And java is extremely far from the overall scope of object oriented
development, I don't do much java and I really don't give a damn what
java programmers do.  (Also, I recall most of the standard java
methods having lower case first letters -- albiet not classes, but
methods were what I was referring to in the first place)

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:53 • by tag
36808 in reply to 36806
Anonymous:
I think most of you are missing the point here.

The PascalCase for classes/members is the .NET standard, the same way
camelCase is the Java standard (the parameters, though, should be in
camelCase, which doesn't happen in the second method).



The WTF is that this guy is SO Guid-oriented, he feels he need to convert everything to a Guid, even when it doesn't make any sense.




I didn't miss the point but I found this code to be simply annoying
(maybe a "why the hell?") rather than appallingly illogical so I
started a seperate thread of conversation spawned in part by my having
a metric-fuckton of VBScript dropped in my lap this lovely morning (god
help me).

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:53 • by chep

WTF: ba[0] + (ba[1] << 8) + (ba[2] << 16) + (ba[3] << 24);


suppose to be


ba[0] | (ba[1] << 8) | (ba[2] << 16) | (ba[3] << 24);


Parentheses are optional...


I don't know why people (especially from VB corner) mixing OR and ADD instructions...[:^)]  


Everything else looks fine to me - people just trying to "pack" integer into Guid therefore fool some 3rd party lib with ugly parameter or database or somebody else’s “DB layer” and make these types "compatible"…


Newer done this before? Well, welcome to the real world where you must have “compatibility” today (sometimes yesterday) no mater what and changing table structure/DB Layer is out of questions because it’s not your table but customer’s and he uses it in his other projects…


I don’t see the “whole picture” from this snippet, maybe it’s really dumb solution. What I trying to say is it _could be_ a real deal. [;)]


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 14:56 • by Head Case
36810 in reply to 36801
Now you've just typed a WTF as
CamelCase is the preferred coding standard of Object Orientated
Languages.... Java coders will (and should) type their method names the
same way.




Umm,  no.

Even Microsoft's own naming guideline page treats lowerCamelCase as "real" CamelCase.



From:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconcapitalizationstyles.asp



Camel case


The first letter of an identifier is lowercase and the first letter
of each subsequent concatenated word is capitalized.


If you read further, you will see that Microsoft recommends a
mixture
of (lower) CamelCase and Pascal Case (or UpperCamelCase) for .NET
identifiers.  Java likewise recommends a mixture of cases
depending on type -- think methods in lowerCamelCase, class names in
Pascal Case.)



Microsoft took a look at Sun's conventions, and decided to change them,
even for J#, rather than go with what had been there for (at least a
few) years.  Whether you
think they did that in an effort to improve coding environments, to
keep compatibility with their own pre-existing conventions, or just to
tweak a
competitor depends on the brand of tinfoil hat you wear.  But
there is no "one true convention" that cuts across every language.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:13 • by Grimoire
While silly, this is more of a WTH than a WTF.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:19 • by kalahari
lower_case_with_underscores_rules! (EXCEPT_FOR_CONSTANTS)

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:26 • by Miszou

The real WTF is, of course, the unrelated argument about the capitalization of a single letter in a method name with 29 letters.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:27 • by Perry Pederson

Heh-- I'm the poster, and was surprised that people are more interested in CamelCase than using a Guid to store an int value.


The Guid is never used for the purpose of a Guid.  The code I inherited uses these Guid<-->integer "translator" methods in several places to store an integer value (for some twisted reason) in a Guid "object".


There are Guid comparisons in the code (if (g1 == g2)), and, to my delight even a 'empty' Guid value


      Guid gEmpty = new Guid(0,0,0,0,0,0,0,0,0,0,0);


for those special occasions where you need to set or validate a Guid with no value.


[:#]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:34 • by Simon
Hmmm.

People saying this isn't a WTF. And going on about camel case.

The WTF here is that [GU]UIDs are supposed to be unique. unique over space and time. Not a 'placeholder for some other value'.

This may not be _wrong_ as such, but it's - well. wrong.

(Oh, and to th poster who claimed there was a difference in using + and |, in the code you quoted there's not. either is acceptable, but the | is more consistent as the rest of the code is bit manipulation too)

Simon

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:34 • by Marc Rohloff
Alex Papadimoulis:

Then there are those who have to work with and maintain systems built by the wish-I-chould-change-my-name-to-a-GUID type.



And here's your chance:


cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=51340&item=7163650842&rd=1


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:42 • by ItsAllGeekToMe
36818 in reply to 36796

tag:
I love how I can recognize anything MS related or code written by MS programmers because their method and programme names always begin with upper case letters.


 


I love how I can recognize anything idiot related or posts typed by idiots because their replies and messages always miss the point.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:43 • by chep
36819 in reply to 36815
Anonymous:

There are Guid comparisons in the code (if (g1 == g2)), and, to my delight even a 'empty' Guid value


      Guid gEmpty = new Guid(0,0,0,0,0,0,0,0,0,0,0);


for those special occasions where you need to set or validate a Guid with no value.


[:#]



May be people find "camelCase" discussion more interesting than you piece of code... [:D]


Ok, what's wrong with this one?


Forgot to use Guid.Empty? Big deal!


Help me people! I just couldn't see the point of today's wtf... [:S]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:49 • by jrock
36820 in reply to 36812
kalahari:
lower_case_with_underscores_rules! (EXCEPT_FOR_CONSTANTS)




This is what I've always done, because I don't like CamelCaseWithAOneLetterWordInThere. this_is_much_easier_to_read.



God invented underscores for a reason :) 



(Then I'm a C/UNIX kind of guy, so I think you Windows/C#/Java people are kinda weird anyway.)

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:53 • by rikkus
36821 in reply to 36815
Anonymous:


There are Guid comparisons in the code (if (g1 == g2)), and, to my delight even a 'empty' Guid value

      Guid gEmpty = new Guid(0,0,0,0,0,0,0,0,0,0,0);


for those special occasions where you need to set or validate a Guid with no value.




Except that that does have a use - as a null
value. You could use null, or Nothing, or whatever your language
calls lack-of-an-object, but sometimes a slightly impure object model
is practical. The .NET framework provides a 'null' GUID object.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 15:59 • by lunk
What exactly is a GUID good for? I've never run across them.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:11 • by chep
36823 in reply to 36816

Anonymous:


(Oh, and to th poster who claimed there was a difference in using + and |, in the code you quoted there's not. either is acceptable, but the | is more consistent as the rest of the code is bit manipulation too)



Well it's not a "consistency" issue it's "apples and oranges"...


1 + 1 = 2;


1 | 1 = 1; //hmm... =| must be a bug in my VS...


BUT


1 + 2 = 3;


1 | 2 = 3; //Look ma! No difference!!! =)


P.S. I have people with the same ideas at work, who debug multithreaded apps on single proc desktops and yeah! I'm getting every build: "Everything worked on my computer, donno why quatro-proc production is in ruins... Must be a HW issue..."

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:19 • by dubwai
36824 in reply to 36820

Anonymous:
kalahari:
lower_case_with_underscores_rules! (EXCEPT_FOR_CONSTANTS)


This is what I've always done, because I don't like CamelCaseWithAOneLetterWordInThere. this_is_much_easier_to_read.

God invented underscores for a reason :) 

(Then I'm a C/UNIX kind of guy, so I think you Windows/C#/Java people are kinda weird anyway.)


The bad thing about camel case is when people insist that Acryonymns must remain all caps in the methods.  So instead of:  ScubaGear, you end up with SCUBAGear.  I can't seem to convince anyone that it isn't important that something is an acronym when you are naming things in code.  This was especially stupid at my last job when no one knew what the letters in the acronyms meant.  They were just words to us.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:22 • by dubwai
36825 in reply to 36823
Anonymous:

Anonymous:


(Oh, and to th poster who claimed there was a difference in using + and |, in the code you quoted there's not. either is acceptable, but the | is more consistent as the rest of the code is bit manipulation too)



Well it's not a "consistency" issue it's "apples and oranges"...


1 + 1 = 2;


1 | 1 = 1; //hmm... =| must be a bug in my VS...


BUT


1 + 2 = 3;


1 | 2 = 3; //Look ma! No difference!!! =)


P.S. I have people with the same ideas at work, who debug multithreaded apps on single proc desktops and yeah! I'm getting every build: "Everything worked on my computer, donno why quatro-proc production is in ruins... Must be a HW issue..."



I think you missed the point.  The code is shifting each bit such that none of the set bits can possibly overlap.  There is no way for + to produce a different result than | when that is done.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:23 • by joe_bruin
36826 in reply to 36809
Anonymous:

WTF: ba[0] + (ba[1] << 8) + (ba[2] << 16) + (ba[3] << 24);


suppose to be


ba[0] | (ba[1] << 8) | (ba[2] << 16) | (ba[3] << 24);


Parentheses are optional...


I don't know why people (especially from VB corner) mixing OR and ADD instructions...[:^)]  




Sure, OR is the right way to do it.  But perhaps you care to
tell us under what conditions these two operations
produce different results.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:33 • by chep
36828 in reply to 36825
dubwai:

I think you missed the point.  The code is shifting each bit such that none of the set bits can possibly overlap.  There is no way for + to produce a different result than | when that is done.



That's exactly my point! [:)]


Just because it "works" in this particular case doesn't mean you have any excuse to use it.


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:46 • by Perry Pederson
36829 in reply to 36819

From http://en.wikipedia.org/wiki/GUID:


Each generated GUID is "mathematically guaranteed" to be unique. This is based on the simple principle that the total number of unique keys (2128 or 3.4028 \times 10^{38}) is so large that the possibility of the same number being generated twice is virtually zero.


All Guids are always supposed to have unique values across all space and time.  Assigning a Guid a value from another Guid could be useful if you needed to retain the unique value in an application.  But assigning an integer value to a Guid totally defeats the raison d'être of a Guid, which is that the value should always be unique.


Creating an 'empty' Guid value implies that more cluelessness (or WTF-es-ness) is afoot; it shows that the original author intended to do more than simple Guid comparisons, but needed to assign and/or check to see if a Guid value was actually empty-- and since the sole purpose of a Guid is to provide a universally unique random value, it makes no sense to assign or test it with a "constant" Guid that has a "zero value".

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:48 • by chep
36830 in reply to 36822

Anonymous:
What exactly is a GUID good for?


Abso-lute-ly nothin'!


Say it again! [H]


--


Sorry, couldn't resist... [:D]


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 16:59 • by loneprogrammer
36831 in reply to 36822
Anonymous:
What exactly is a GUID good for? I've never run across them.


Basically it is nothing more than a 128-bit number.  GUID stands
for Globally Unique Identifier, and is usually created by combining
things like your IP address, MAC address, and the current time. 
This should come up with a completely unique number that will never be
reused.  Theoretically there is a tiny chance that it will be
reused, since there is nobody handing out GUIDs, there might be another
one out there that is the same as yours, but the chance is so low that
we pretend it is impossible.



Their true purpose is to give globally unique IDs to COM object
libraries, so you can install yours on any machine in the world and it
won't conflict with any other ones.  You don't have to ask anybody
for a GUID, you just create a new one and use it.  If it was only
8 bits, you could only have 256 libraries in the world before you start
having conflicts.



For something like a database primary key, you don't have to use 128
bits unless you plan to have a database bigger than the universe, so
using an autoincrement 32 bit number is fine.



Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 17:06 • by loneprogrammer
36832 in reply to 36829
More GUID info.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 17:15 • by Matt Moriarity
36833 in reply to 36812
kalahari:
lower_case_with_underscores_rules! (EXCEPT_FOR_CONSTANTS)


I know a Ruby programmer when I see it!

GO RUBY!!!

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 17:16 • by chep
36834 in reply to 36829
[;)]
Anonymous:

Creating an 'empty' Guid value implies that more cluelessness (or WTF-es-ness) is afoot; it shows that the original author intended to do more than simple Guid comparisons, but needed to assign and/or check to see if a Guid value was actually empty-- and since the sole purpose of a Guid is to provide a universally unique random value, it makes no sense to assign or test it with a "constant" Guid that has a "zero value".



There is a difference between "generating a new number" (or "creating a new instance") and working with existent ones...


If you generating numbers without ability to at least compare them - what is the purpose of this numbers? How to use em?


What is wrong with empty guid as a NULL-equivalent value for a value-type? How to say "undefined" in C# for Guid without using Empty?


>> and since the sole purpose of a Guid is to provide a universally unique random value


I think, you've mistaken Guid generator (which creates a new instance of type Guid) and Guid object - which is a container for this value therefore may contain _any_ value. The purpose of the Guid is to HOLD 16 byte value, period!


Think of it like LAARGE int and rand() function with huuuge range... (bad comparison but fair anough) 


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 17:24 • by chep
36835 in reply to 36831

loneprogrammer:
Anonymous:
What exactly is a GUID good for? I've never run across them.

For something like a database primary key, you don't have to use 128 bits unless you plan to have a database bigger than the universe, so using an autoincrement 32 bit number is fine.


The problem is in incrementing this value on the client whithout roundtrip to database (and don't give me MAX() + 1 sh*t) when you have to know PK before you insert (for child records for ex.)


Whith Guid you (presumably) safe.


I'm not even talking about replication... [:'(]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 17:42 • by WTFer
I have found GUIDs pretty useful when the objects are created by
different people in different places (for example, a sales database
where new records are added from an offline laptop and need to sync
with the server).  Specially if the objects or entities are build
offline, so you know the ID's will never crash. Thus making this a WTF,
since these GUIDs don't have the properties associated with real GUIDs
and gives you no extra security against id crashing than using a simple autonumbered int.

--Mexican, really sorry for the broken english


Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:07 • by spotcatbug
36837 in reply to 36834
Anonymous:
The purpose of the Guid is to HOLD 16 byte value, period!


Just because 16 bytes happens to be the size of a GUID instance? Um.... no.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:09 • by spotcatbug
36838 in reply to 36837
Could somebody kindly explain how to create a reply with quoted text in it (without it being a garbled mess like the above)?

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:13 • by dubwai
36839 in reply to 36838

spotcatbug:
Could somebody kindly explain how to create a reply with quoted text in it (without it being a garbled mess like the above)?


I think you have to use IE.  You are using FireFox, right?

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:13 • by chep
36840 in reply to 36838

spotcatbug:
Could somebody kindly explain how to create a reply with quoted text in it (without it being a garbled mess like the above)?


Avoid Preview button - real WTF!  [:D]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:16 • by dubwai
36841 in reply to 36836

WTFer:
I have found GUIDs pretty useful when the objects are created by different people in different places (for example, a sales database where new records are added from an offline laptop and need to sync with the server).  Specially if the objects or entities are build offline, so you know the ID's will never crash. Thus making this a WTF, since these GUIDs don't have the properties associated with real GUIDs and gives you no extra security against id crashing than using a simple autonumbered int.
--Mexican, really sorry for the broken english


Broken?  Your English is better than most 'Mericans and Brits.  Written English, anyway.  Don't wanna see no more apologies from you.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:19 • by dubwai
36843 in reply to 36829

Anonymous:
Each generated GUID is "mathematically guaranteed" to be unique. This is based on the simple principle that the total number of unique keys (2128 or 3.4028 \times 10^{38}) is so large


Whatever, I totally know about numbers that are way larger than that. [:P]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 18:46 • by BiggBru
Forgive me if I'm wrong, but isn't this WTF more about the particular usage of GUID that about case preferences? I may be going out on a limb here, but it seems that 98.5% of the replies have been about the choice of casing for this snippet of code. Why can't we all just get along? [;)]

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 19:19 • by John Smallberries
36845 in reply to 36839
dubwai:

spotcatbug:
Could somebody kindly
explain how to create a reply with quoted text in it (without it being
a garbled mess like the above)?


I think you have to use IE.  You are using FireFox, right?



Successfully quoted with FireFox 1.0.4.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 20:12 • by Foon
36846 in reply to 36800

Brendan Kidwell:
"Always," you say... Hmm, isn't consistency one of the keys to code readability? So what's wrong with them doing it that way if they're consistent about it?


The idea of a GUID is that it should be universally unique. No two GUIDs in the entire universe ought to be the same. Constructing a guid like this (id, 0,0,0,0,0 ,... ) undermines the whole idea of them. You might be using a GUID object, but it is not really a GUID at all.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 20:12 • by eaw4etz5rtg3wy35e
36848 in reply to 36845
John Smallberries:
dubwai:

spotcatbug:
Could somebody kindly
explain how to create a reply with quoted text in it (without it being
a garbled mess like the above)?


I think you have to use IE.  You are using FireFox, right?



Successfully quoted with FireFox 1.0.4.




I think it's this weird WYSIWYG thingy.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 20:41 • by chep
36849 in reply to 36846
Foon:

Brendan Kidwell:
"Always," you say... Hmm, isn't consistency one of the keys to code readability? So what's wrong with them doing it that way if they're consistent about it?


The idea of a GUID is that it should be universally unique. No two GUIDs in the entire universe ought to be the same. Constructing a guid like this (id, 0,0,0,0,0 ,... ) undermines the whole idea of them. You might be using a GUID object, but it is not really a GUID at all.



>>No two GUIDs in the entire universe ought to be the same.


Are you talking about Guid-container or Guid-generator?


 

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 21:01 • by FrostCat
36850 in reply to 36836

WTFer:
I have found GUIDs pretty useful when the objects are created by different people in different places (for example, a sales database where new records are added from an offline laptop and need to sync with the server).  Specially if the objects or entities are build offline, so you know the ID's will never crash. Thus making this a WTF, since these GUIDs don't have the properties associated with real GUIDs and gives you no extra security against id crashing than using a simple autonumbered int.
--Mexican, really sorry for the broken english


 


Man, that's totally the point of GUIDs--to create "references" that are more or less guaranteed not to collide with GUIDs created on other computers.


Note that if you are running Windows without a NIC, the last 6 bytes of any generated GUIDs using the MS tools that ship with Visual Studio will always be the same, so it's theoretically more likely to have collisions.  Of course, when you're dealing with 10**38, what's a couple of orders of magnitude among friends?

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 23:23 • by Davey
36853 in reply to 36850
FrostCat:

WTFer:
I have found GUIDs pretty
useful when the objects are created by different people in different
places (for example, a sales database where new records are added from
an offline laptop and need to sync with the server).  Specially if
the objects or entities are build offline, so you know the ID's will
never crash. Thus making this a WTF, since these GUIDs don't have the
properties associated with real GUIDs and gives you no extra security
against id crashing than using a simple autonumbered int.
--Mexican, really sorry for the broken english


 


Man, that's totally the point of GUIDs--to create "references" that
are more or less guaranteed not to collide with GUIDs created on other
computers.


Note that if you are running Windows without a NIC, the last 6 bytes
of any generated GUIDs using the MS tools that ship with Visual Studio
will always be the same, so it's theoretically more likely to have
collisions.  Of course, when you're dealing with 10**38, what's a couple of orders of magnitude among friends?





Hmm, interesting. So erm, what would this value be?
 * Anonymous looks though all the GUID's and laughs at the poor developers without NIC's

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-22 23:56 • by DrCode
36854 in reply to 36829
Anonymous:

From http://en.wikipedia.org/wiki/GUID:


Each generated GUID is "mathematically guaranteed" to be unique.





Thanks for reminding me, I've been meaning to change that.  HHOS.

Re: Call Me {F2A94419-12AD-4244-87F2-F1D7D21997F6}.

2005-06-23 00:09 • by DrCode
36855 in reply to 36834
Anonymous:

What is wrong with empty guid as a
NULL-equivalent value for a value-type? How to say "undefined" in C#
for Guid without using Empty?





Guid guid = null;  // why not?



BTW, I just have to chime in on the PascalCase thing.  camelCase
isEasyToRead evenWithWtfAcronyms, but_lower_case_with_underscores is
easy to read, too.  I was a C programmer for years, and thought
camelCaseWasHideous, but after using Java for a while I realize it's
just a matter of what you're used to.



PeopleWhoUsePascalCase (for methods) should be shot, however.  Oh,
and IWhat is the IDeal with IInterfaces IBeginning with I?  Unless
you're defining an interface for a type that can lead a slave rebellion
and want to call it ISpartacus, please leave the gdHungarian where it
belongs, in the ashheap of code history.



« PrevPage 1 | Page 2Next »

Add Comment