I am just working through OOP stuff myself... Regarding the object factory, would you have a separate factory for each object, say the object was User, like UserFactory? So if you were instantiating a User and then populating the bean from the db, (assuming all the obvious stuff, your classes are init'd into the Application scope etc.) the call would be
<cfset tempUser = Application.UserFactory.getInstance()> <cfset myUser = Application.UserDAO.read(tempUser)> Or is there another best practice for handling a factory? Also, what is the generally accepted way to init your classes into the Application scope, is this just done in App.cfm or App.cfc? Thanks for any guidance. -- Josh ----- Original Message ----- From: "Adrian" <[EMAIL PROTECTED]> To: "CF-Talk" <[email protected]> Sent: Monday, December 11, 2006 8:50 AM Subject: Re: whats the purpose of an objectFactory? > The real benefits I have found are: > > 1) > Objects are initialised in one place only, so if the init arguments > change, > then I only need to change one piece of code. > > 2) > Objects are created in one place only, so if the location of the component > changes, then I only need to change one piece of code. > > 3) > Less code! > > application.myfactory.getInstance() > > is less code than > > createobject("component","path.to.my.component").init(application.dsn, > application.somethingelse) > > > > On 11/12/06, Phill B <[EMAIL PROTECTED]> wrote: >> >> I have read a lot about people making their own objectFactory and I >> still don't see the need for one. Can some one please give me a reason >> why I would need to use one? So far I have yet to find a reason not to >> call to the objects directly when I need them. My lack of >> understanding makes me think it is just adding more code than is >> required. >> >> -- >> Phil >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263546 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

