On Dec 4, 2003, at 6:30 AM, Brian Kotek wrote:
Thanks for that Sean, nice to see that I'm on the right track in most
instances at least.  This one I thought deserved a closer look though.
What I was really thinking of here is a Mach-II application, where
clearly all the listeners are in the application scope.  If you want to
implement a shopping cart, and you choose to do it using a façade of
some sort, what do you do?

Take a look at the sample shopping cart sample application. The listener delegates all of its cart-related operations to a cart CFC instance that is held in session scope.


I'm picturing a façade listener that then
interacts with a cart CFC in a HAS-A relationship (i.e. the cart CFC is
an instance variable within the cart façade listener).

No - instance variables in listeners won't do you any good since they are in application scope. The façade *manages* the cart in session scope.


listener (pseudo-code):
        function addToCart(product) {
                if (not structKeyExists(session,"cart"))
                        session.cart = createObject("component","cart");
                session.cart.addProduct(product);
        }

The cart CFC is standalone (i.e., independent of the Mach II framework).
        
If you wanted to
pass a productID to your cart façade, and then have it update the cart
instance variable to reflect the addition of the new product, would you
need to lock that update?

No. See above.


Hope that clarifies things?

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to