Brian -

I follow what you are saying with composition (the decorator pattern sorta), 
the problem is, I don't know what these extra properties are before run time in 
order to create a new object to extend the base object.  This is not a good 
example, but assume I have a user object.  The end user of the application can 
then say in his/her case they want to track the users employeeID, so they add a 
new property to user called employeeID.  So, the structure with get/set 
functions is about the only way I can see to do this, it just does not seem 
quite right.

Thanks for the help.
-- Jeff


>If you want to add/change data or behavior at runtime, you really have two
>options. One is to use what you're describing, which is really based on Duck
>Typing. CF is a dynamic language and as a result you can add methods to
>objects at runtime. However, you're right, this does make the API more
>difficult to understand because the object has no definite API, and you are
>relying to client code to "know" that a given object has certain properties
>or methods if you are adding or removing them dynamically at runtime.
>
>The other option is to use Composition. This is how most strongly-typed
>languages change behavior at runtime. The API to the object remains fixed,
>but you are free to swap out different objects in the composition
>relationship to provide different behavior. An example might be encryption:
>say you have an object that needs to perform encryption on a string, but you
>want to be able to vary the actual encryption implementation. You can
>compose different encryption objects into the target object, and the object
>just calls encrypt() on the composed object. Depending on what encryption
>object you have composed into the object, the actual encryption
>implementation will change.
>
>Hopefully that makes sense.
>
>Brian
>
>
>On Nov 12, 2007 8:55 AM, Jeff Chastain <[EMAIL PROTECTED]> wrote:
>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293141
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to