I like using an instance structure sometimes to seperate out the instance
variables from anything else that may be in the variables scope. It can make
it easy to grab a memento of the object's state, for example

getMemento() {
return variables.instance ;
}





> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Steve Bryant
> Sent: Friday, September 09, 2005 2:48 PM
> To: [email protected]
> Subject: [CFCDev] variables.my (Was: Method parameters vs method names)
>
>
> Why the "my" in "variables.my.dsn"? What's the advantage over
> "variables.dsn"?
>
> Thanks,
>
> Steve
>
> At 03:08 AM 9/9/2005, Barney Boisvert wrote:
> >You've got it.  Though I'd recommend the constructor, that's what it's
> >there for.  No real need to have get/set methods; how often do you
> >change datasources without reloading your application?  Easier to just
> >set it as an immutable property at instantiation time and forget about
> >it.  And don't forget to scope your query name.  Here's how I do it
> >(with lot of tag attributes missing for brevity):
> >
> ><cfcomponent>
> >
> >   <cffunction name="init">
> >     <cfargument name="dsn" />
> >     <cfset variables.my.dsn = dsn />
> >     <cfreturn this />
> >   </cffunction>
> >
> >   <cffunction name="getEmployees">
> >     <cfset var getEmployees = "" />
> >     <cfquery datasource="#variables.my.dsn#" name="getEmployees">
> >       SELECT ....
> >     </cfquery>
> >     <cfreturn getEmployees />
> >   </cffunction>
> >
> ></cfcomponent>
> >
> >cheers,
> >barneyb
>
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the
> subject of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by
> CFXHosting (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> 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' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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


Reply via email to