> > Not necessarily, if you have an event's based system where your event
> > handlers register themselves as being interested in specific events
> eg
> >
> > <cfset registerEventHandler("registerStrings", this,
> "onRegisterStrings")>
> > <!--- event, instance, functionname ---> <!--- in every object that
> may
> > need
> > to know about the strings object --->
> 
> 
> Mach-II does the same thing. However, you generally define what objects
> respond to what events in a central XML config file. In the approach
> you
> describe, where any object may or may not register itself to listen for
> any
> event, how do you keep track of what is responding to what? Unless I'm
> misunderstanding, this sounds like a situation where you have no idea
> what
> is running when an event is raised without actually going and looking
> at
> every CFC that could possibly be registering itself to listen for that
> event. How do you keep track of what is going on?
> 

Essentially, there is a central registry of events that tracks this for me.
I can query the registry to see what objects had registered event handlers
for any given event if I need to, but 99.9% of the time *i don't need to
know* because it handles it all for me. I call this registry the "listener"
because it is the object responsible for registering the event handlers,
listening for events and invoking the relevant handlers.

By giving the responsibility of registration to the init functions of each
object, I do not need to statically configure dependencies in an XML file
like you are describing for Mach-II. Instead, the entire application object
hierarchy configures itself dynamically and any dependencies are resolved
automatically.

Also, by using an object factory to handle the object instantiation, I don't
even have to worry about an object being there or not at start up. If an
object isn't there and a piece of code runs that has a dependency, the
object factory handles the instantiation of that "missing" object.

The only static configuration I have to do for my apps is telling it which
features any given app has. Some clients want a newsletter manager, some
want and e-Commerce system. All I do is set up the objectFactory config file
as required and run the app.

Because we couple this framework with a separate presentation layer (usually
XHTML), most of my work these days is based on configuration, styling and
resource bundle editing :-)... It makes for fast development and turnaround
times with a higher profit margin than building from scratch every time.
Every so often, a client asks for a feature that we don't have so I still
get to build new sets of objects and features in CF. 

I have to say though, I wouldn't attempt to do this sort of thing in PHP
maybe ASP.NET but not PHP... What a hateful situation that would be. CF
makes my life so much easier!

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288001
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