This has gotten a bit off topic, but it is an important discussion none the 
less.
I want to see if I understand what the recommended practice is with regard to 
CFCs. 

I use CFC is two different ways. I have some CFCs that are really just a 
grouping of functions. For example, a common.cfc that contains generic 
functions used by multiple applications or templates.

Another kind of CFC in our applications is what sparked this thread. Say I have 
a cart.cfc that will contain all the logic for our shopping cart. Each user 
(session) has their own instance of the cart. In this cart.cfc, there are 
cart-related functions, such as addItemtoCart and removeItemFromCart. There are 
also instantiation variables set at the top of the CFC (outside of functions) 
such as this.cartCreatedDate and this.cartLastModified. These variables are 
accessible outside the CFC (which they should be) by referring to 
myobj.cartCreatedDate.

Are you saying that a better practice would be to set up a structure local to 
the CFC that is not accessible outside the CFC directly? And then build in a 
function to getVariable and setVariable? If I have 30 of these variables, I 
have a hard time getting past the notion that 30 calls to getVariable would not 
be significanly slower than having them just by CreateObject call in the first 
place. It is just a gut feeling--maybe there is no major difference in speed 
and performance?

Can you provide a really basic example of how you would construct this cart.cfc 
and call it?

Thanks for your input--

Tim

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236655
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to