not sure why barney has used "my", but I will quite often break up the variables into diff structs, just because it seems tidy to me. e.g.
variables.cfg variables.obj variables.qry so i might even have: variables.cfg.db.dsn variables.cfg.db.dbtype -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Steve Bryant Sent: 09 September 2005 13:48 To: CFCDev@cfczone.org 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 cfcdev@cfczone.org 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/cfcdev@cfczone.org ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org 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/cfcdev@cfczone.org