The one thing that will help you to make the proper decision(s) regarding 
object calls will be to lay out your application framework ahead of time and 
set up rules to govern communications between objects.  If you set the proper 
rules, they're easy to follow and you won't find yourself having to bend/break 
them.

As an example, here is how we set up our model:

Subsystem layer:  CFCs representing core business applications and data stores 
(listserv, CRM/fulfillment system, database, etc.).  These are *dumb* objects 
that can only submit/return data from these systems.

Business logic layer:  These are objects identified as major players in our 
model.  They are not allowed to talk to each other.  They utilize the subsystem 
layer to gather, cache, and process the data they represent.

Business logic interface layer:  A single CFC that governs all communication 
with the BL layer.  This CFC is essentially an assembler/constructor that calls 
the BL CFCs to perform specific jobs.

User interface layer:  Web site templates that communicate with the business 
logic interface CFC.  The UI is not allowed to access the BL directly.  Putting 
this rule in place has helped to streamline our code and make it immensely 
easier to manage.

There *are* other objects in the system that function outside of these rules, 
but they are few.  We have the token user/customer session object, and a 
security object (server scope) that has free reign over the entire system.

There are other rules in place for these objects as well, besides actual O-O 
communication.  Scope access is one of the bigger ones.  Objects are not 
allowed to access information outside of the scope they live in.  Sounds 
drastic, but it works very well and keeps the model clean.  If a job requires 
the combination of data from several scopes, it typically happens at the 
template level (probably in a custom tag), with object calls bringing data to 
the template and the end result passed along to its destination.

Anyway, granted this might not be true OO design, but it's working well (and 
fast), holding up under load, and it's a heck of a lot easier to manage code 
now than it was a year ago :)

Matt

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184279
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to