That being the case, you would have to have a class for every combination
optional attribute, or combination of optional attribute.  I do like this
idea, do you think it would be wise to come up with a healthy balance or
blend of empty strings, and inheritance based on what makes sense for each
situation?  On this same note, would you then want to have extended classes
to handle multiplicity.  Meaning if an object can have 0..* other objects,
would you then need to have an extended class for the instances where there
are more that 0 objects.  I think I just started rambling....I am more than
willing to clarify if need be?

Thanks,
Justin

-----Original Message-----
From: Matt Liotta [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Optional Instances of Components


The proper OO way of handling this IMHO would be to create a Dog 
interface that defines methods common to all Dogs. You could then 
create a Corgi class that implements the Dog interface. Any Dog that 
has a tail method would be considered implementation specific as a tail 
is not defined by the interface.

Now then, since you can't use interfaces in CFMX, then you would 
probably want to use inheritance instead. In that case, you would 
create a Dog CFC and then extend it with a Corgi CFC with any specifics 
to a Welsh Corgi in the Corgi class.

-Matt

On Thursday, September 25, 2003, at 11:45 AM, Justin Balog wrote:

>
> Howdy,
>
> I am just curious how you might handle optional instances vars in
> components.  Lets say I have a dog cfc.  It always has a weight, but 
> as my
> dog (a welsh corgi) can attest he has no tail.  Therefore, a dog may 
> or may
> not have a tail.  Does that mean that I just have an empty instance 
> var?
> Here is how I would currently write it. Then if the arguments were
> available, I would use the setters individually?  Is there a better 
> way to
> do it?  Thanks much!  ----Sorry for the short hand bellow.
>
>
> <cfcomponent>
>       <cfset variables.weight = "" />
>       <cfset variables.tail = "" />
>
>       <cffunction init>
>               <cfargument name="weight"/>
>               <cfset setWeight(arguments.weight) />
>       </cffunction>
>
>       <cffunction setWeight>
>       </cffunction>
>
>       <cffunction getWeight>
>       </cffuction>
>
>       <cffuction setTail>
>       </cffuction>
>
>       <cffuction getTail>
>       </cffuction>
>
> </cfcomponet>
>
>
> Justin
>
> P.S. Just in case you were wondering what a tail less dog looks like, 
> here
> you go!  THEDUKE! (Just so everyone knows, I did not cut his tail 
> off.....he
> came form the rescue that way.)
>
> http://www.hossedia.com/desktops/duke_1024.jpg
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[EMAIL PROTECTED]
>
>
Matt Liotta
President & CEO
Montara Software, Inc.
http://www.MontaraSoftware.com
(888) 408-0900 x901


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to