Hey Barney, I tried out your suggestion of creating objects with empty instances of dependent objects and then setting them afterwards - and it works out! You never have to "remember" to do it, because the need is right there... it's a natural process since you were going to pass in a stateful object anyway - may as well just set it.
The only time it gets a little quirky is if the dependent object is stateful AND application-wide. Something like a MSG component that keeps track of what your CFCs are doing and then displays the messages back to the user. You need to pass it in to each CFC but you can't pass in an empty one because you'll lose the previous messages. So you'll have to set it with each create. If you could somehow pass it in automatically each time without explicitly referencing it, it would be nice. *** You said you normally create a "manager" per entity type. Is an entity like User, Customer, Products? I'm curious what additional methods you may need for User but not Products, or Customer but User, etc... Cheers, Baz -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barney Boisvert Sent: Thursday, November 03, 2005 12:59 AM To: [email protected] Subject: Re: [CFCDev] Factory Pattern I'll typically have a service factory that is used by the UI (or UI's), and then where I'm using entity objects, I'll have a factory per entity type. Of course, I don't actually build dedicated factory objects, I build "managers", which include the getNewUser method, but also have various other methods for managing user entities. You could certainly call those objects "factories", but I prefer "manager" to differentiate them from objects that ONLY act as factories. So both yes and no. ;) You'll find that you get that answer a lot in the OO design world, because there's so rarely a single correct answer for anything. cheers, barneyb On 11/1/05, Scratch <[EMAIL PROTECTED]> wrote: > > Sorry for the triple-post... u guys gave a lot of material! > > Barney, in your example you have a UserFactory class - was that just an > example or do you normally build such granular Factories? How many factories > do your apps usually have? > > Cheers, > Baz > > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
