Aaron, Thanx for watching the presentation. I hope it helped you.
The first part of the presentation was to demonstrate some OO principals, and to show how you could transform a procedural application into one more OO. It was during this part where we were creating all the gateway objects when we needed them. In the latter portion of the presentation, we discussed optimizing the application with the use of factories and caching objects in a shared scope (the application scope). If you go to Phill's site, http://www.phillnacelli.net/blog/index.cfm/2006/11/17/Central-PA-CFUG-Preso-Recapand download the code, you will see that we used an object factory to create the gateway objects using the create() method. When these gateways were used in the application, they are not being created, merely returned from the object factory. Since the gateway objects were specified as a 'singleton', only one instance of the objects will ever be in memory. In the application files, when we once again called the create() method of the object factory, it merely returned a reference to the object already cached in the application scope (Remember, complex data types, including objects, are passed by reference). So while the code on the some of the files may seem like new objects are being created each time a page is hit, a look at the code in application.cfm, and in objectFactory.cfc will show that the only time a new gateway object is created is when one does not already exist, or if you manually reinit the applciation by adding ?reinit=true to the end of a URL. On 11/21/06, Aaron Roberson <[EMAIL PROTECTED]> wrote: > > I watched a presentation from the guys at AboutWeb.com about Object > Oriented Programming in Coldfusion and Phill Nacelli's Object Factory > got me wondering a few things. > > Is it possible to initialize all of the object gateways into the > application scope in Application.cfm? It seems like it would be better > to create and initialize the object once and then reference it on each > page instead of creating it on each page. > > In Application.cfm I would have: > > <cfset application.personGateway = > createObject("component","path.personGateway").init(application.dsn) > /> > > Then on the pages I would just do something like: > > <cfset getPeople = application.personGateway /> > > What do you think, am I off somewhere with all of this OOP stuff? > > -Aaron > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261357 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

