> thanx again Mark. It's leading to a couple of more questions, I'm
> afraid...
No probs.
> you've confused me now. The only thing I've done different from usual
> is not used an argument in invoking the component and the CFC not having
> properties. Perhaps I'm getting confused with CFC interfaces seemimg
> to be like structs themselves, not like real objects eg: COM (actually,
> they feel more like VBScript classes than objects).
No, you've misunderstood me.
The problem isn't your cfc. The problem is the fact that you are trying to call a
method on a struct. - i.e. you would get the same error is I just went:
<cfscript>
a = StructNew();
a.runThisMethod();
</cfscript>
> Ummm... why the array? is this for an array of structures or a struct
> of arrays?
Or use a struct - sorry. I would use an array of Product CFC instances, so I just
went back to that. You could use a struct. Your choice.
> so the instance is stored in the session?
Yup. Persistance CFCs.
> How does session.cart get updated with new cart contents within the CFC?
Forget the session.cart struct you had earleier.
you can access the values of the CFC normally i.e. either to go:
<cfset product = session.cart.aProducts[4]>
or call your methods on it
<cfscript>
session.cart.addProduct("1", "2");
</cfscript>
>and what would you do if cookies or a db have to be used instead?
Then I would write some sort of mutator methods on the CFC.. so an add, update,
and delete methods... (maybe even a 'read', depending on the neccessity of the
application)
Then I don't need to care HOW the information is stored, I can just do it.
>you've made a good point about the loose coupling but it's satisfying the other
>side (tight cohesion) that worries me on this bit.
Why?
The cart is a cart is a cart. It doesn't touch the any shared scopes (which I don't
think CFCs should do unless that is their specific job). All it does it manage what
products the user is currently playing with. Sounds like tight cohesion to me.
HTH
Mark
-----------------------------------
[EMAIL PROTECTED]
ICQ: 3094740
Safe From Bees
[www.safefrombees.com]
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/