Being that you have stored them in the request scope, the CFIFs are pointless since the request scope is NOT persistent. I store settings such as the applications database name in the application scope since it is global to all requests and does not change for the app. I also store CFCs in the application scope.
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -----Original Message----- From: Vince Collins [mailto:[EMAIL PROTECTED] Sent: Thursday, September 20, 2007 9:12 AM To: CF-Talk Subject: Instantiating all objects within Application.cfm While building my first app using CFCs yesterday, I found it easier for me to do a test for the existence of an object and if not found, instantiate it within Application.cfm like this. <cfif NOT isDefined("request.dsn")> <cfset request.dsn = "mydatabase" /> </cfif> <cfif NOT isDefined("request.inventory")> <cfset request.inventory = createObject("component", "cfcs.inventory").init(request.dsn) /> </cfif> <cfif NOT isDefined("request.classes")> <cfset request.classes = createObject("component", "cfcs.classes").init(request.dsn) /> </cfif> ... /application.cfm Each instantiation is calling a simple init() method within the class such as this one within inventory.cfc: <cfcomponent hint="Inventory Object"> <cfset variables.dsn = "" /> <cfset variables.inventory = "" /> <cffunction name="init" access="public" returnType="inventory" output="false" hint="I instantiate qry"> <cfargument name="dsn" type="string" required="yes" /> <!--- initiate value(s) ---> <cfset variables.dsn = arguments.dsn /> <cfset variables.inventory = "none" /> <cfreturn this /> </cffunction> (there are more methods within this cfc but I'm leaving them out to make this easier to read.) </cfcomponent> My thought here is that I will always have access to the instantiated objects without having to test for their existence. However, since I'm not completely familiar with how this all works, Am I creating large amounts of overhead to the server for this convenience? I wouldn't think so since I'm not calling any major methods yet but maybe there is more going on? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288918 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4