Yes I don't think I'm following what you're trying to do. If employeeID is a
property of the User object, why wouldn't it already be there from the
start? I'm not clear on what the "end user of the application" has to do
with it.

On Nov 12, 2007 2:01 PM, Jeff Chastain <[EMAIL PROTECTED]> wrote:

> 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:
> >
> >>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

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

Reply via email to