You could also just create an instance variable that holds your UDF CFC
in your init() function.

<cffunction name="init">
  <cfset variables.udfObject = createObject( 'component', 'udf' ).init()
/>
  <cfreturn this />
</cffunction>

vs.

<cffunction name="init">
  <cfargument name="udfObject" type="udf" />
  <cfset variables.udfObject = arguments.udfObject />
  <cfreturn this />
</cffunction>

The answer probably depends on whether you use the UDF CFC elsewhere.
If you use it elsewhere, you may want to create it elsewhere and just
pass a reference to your session CFC.  If you only use it in the session
CFC, you might want to initialize it within the session CFC's
constructor.  Either way, your session CFC would then have a data member
that holds a reference to an instance of your UDF CFC.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Jim Davis
> Sent: Wednesday, September 29, 2004 12:24 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] Function Libraries
> 
> You might instantiate the CFC into the Application scope.  You can
then
> accept the instance into your Session CFCs as a parameter to maintain
the
> abstraction.
> 
> Jim Davis
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf
> > Of Marlon Moyer
> > Sent: Wednesday, September 29, 2004 12:19 PM
> > To: [EMAIL PROTECTED]
> > Subject: [CFCDev] Function Libraries
> >
> > I've got a CFC that contains several UDF's that I use time to time
in
> > my session scoped CFC objects.  Right now, at the top of the session
> > scoped object, I use createobject to instatiate the library.
Looking
> > back at it now, it seems that this way is not very efficient, but
> > storing the library in an application scope and referencing it via
> > applications vars seems to be bad design also.  What other ways
might
> > I do this?
> 
> 
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at www.mail-
> archive.com/[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to