I have seen it set in the init and set to the variables scope. and then
called from individual functions.

So if the passed object is local to *only one* function should I pass it to
just that one function?

Or if it used multiple times in the object I should store it as part of the
object (in the init function) in the variables scope so it can be avalible
to multiple functions.

Does that sound right... make sense?

Thanx
G

On Wed, Mar 5, 2008 at 5:07 PM, Matt Williams <[EMAIL PROTECTED]> wrote:

> On Wed, Mar 5, 2008 at 3:43 PM, Gerald Guido <[EMAIL PROTECTED]>
> wrote:
> > 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.
>
> I vote for passing it in. It makes the component that will use it less
> couple to application scope and therefore more reusable.
>
> If several methods within the component are going to need access to
> various methods in the application.myCFC object, then it would make
> more sense to do what Rich says in step 2. Basically when the
> component that is dependent on app.myCFC is instantiated, it should
> get that instance in variables scope
>
> <cfcomponent name="myDependentCFC">
>  <cffunction name="init">
>     <cfreturn this />
>  </cffunction>
>  <cffunction name="setAppCFC">
>    <cfargument name="AppCFC" />
>    <cfset variables.instance.AppCFC = arguments.AppCFC />
>  </cffunction>
> </cfcomponent>
>
> <cfset myDependentCFC = createObject('component','myDependentCFC').init()
> />
> <cfset myDependentCFC.setAppCFC(application.AppCFC) />
>
> --
> Matt Williams
> "It's the question that drives us."
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:300585
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to