Well, since you asked, here's my take on this: objects do need identity,
beyond the issue of persistence. Look at this code for example:

<cfset foo = CreateObject('component', 'SomeClass').init() />
<cfset bar = ArrayNew(1) />
<cfset ArrayAppend(bar, foo) />

Imagine that we need the ability to be passed an object and to remove that
object from the array. You can't loop over the array, testing whether the
object passed to you is the same as bar[i]: you'll get an exception;
ColdFusion can't compare complex thingies. To get around this, I have a
BaseComponent class that's charged with several responsibilities. One of
these functions is to hold a unique identifier and to implement a
same(object: BaseComponent): boolean method. 

Now, I can loop over bar checking to see if the object passed to me is the
.same(bar[i]). So, since all objects need identity, I think a BaseComponent
is the best place for this.

Hal

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Bill Rawlinson
Sent: Monday, November 14, 2005 1:41 PM
To: [email protected]
Subject: Re: [CFCDev] Who owns the "ID"?

Valid points Seth - but if you can't do the job without using the ID then I
think the statement needs to know about the ID and so does everything else.

Since you mentioned his name I'd love to hear if Hal has a different
suggestion.  But if using the db ID is wrong then I'm almost always wrong
:O)

Bill



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to