>> Also don't forget to var your variables. Why is it that when you ask a CFC question people assume that you aren't scoping your variables?
On Wed, Mar 5, 2008 at 5:01 PM, Russ <[EMAIL PROTECTED]> wrote: > Also don't forget to var your variables. Bad things happen when you don't > var variables that are meant to stay private to the function and you cache > your component. > > RUss > > > -----Original Message----- > > From: Rich [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 05, 2008 4:53 PM > > To: CF-Talk > > Subject: RE: CFC Best practices question > > > > > If I have an object loaded in the Application scope and want to use it > > in > > > another object/component ,should I pass it in as a variable or should > I > > > call > > > it directly from the Application scope. Assume that the object will > > always > > > be loaded in memory. > > > > > > TIA > > > G > > > > I would advise against accessing the component directly. As a general > > rule, > > you should not have any CFC access a scope outside of itself. I would > > suggest one of the following two approaches: > > > > 1. Use a façade to the application scope > > By using a façade, only one component is tied directly to the > application > > scope. > > > > 2. Injection > > Using either constructor or setter injection, pass the object in as a > > variable. > > > > HTH, > > Rich Kroll > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300583 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

