Hi John,

I think the main point of using get/set methods is to hide the
implementation details, which may be more complex than simply
reading/writing class attributes. For example, the "this.setMapping()"
method might:

  - Check security constraints--does the user have permission to modify the
mappings, as configured via the admin console?

  - Validate that the specified directory path is well-formed, that it
actually exists, and that the user under which the server is running has
read access to it.

So it's not simply an issue of having protected attribute scopes (and I'm
sure the CFML server vendors could figure out a way to prevent you from
getting to the underlying attributes directly, and therefore require you to
use the get/set methods).

Vince

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of John Farrar
> Sent: Saturday, October 01, 2005 10:22 PM
> To: [email protected]
> Subject: RE: [CFCDev] Java CFCProxy info?
> 
> While I understand the get and set issue Vince. The issue is 
> because the variables do not have protected scopes in CF. (In 
> PHP 5 they have even figured this out... and it is kinda nice 
> how they do that there. Not nice enough to move me from CF, heh.)
> 
> John Farrar
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Vince Bonfanti
> Sent: Saturday, October 01, 2005 7:44 PM
> To: [email protected]
> Subject: RE: [CFCDev] Java CFCProxy info?
> 
> 
> How about a method defined on Application.cfc:
> 
>     <cffunction name="onApplicationStart" ... >
>         <cfset this.setMapping( "mapName1", 
> "D:\inetput\mapdirectory" )>
>         ...
>     </cffunction>
> 
> You could also define a this.getMappings() method to return a 
> struct of existing mappings. Maybe something like this:
> 
>     <cffunction name="onApplicationStart" ... >
>         <cfset mappings = this.getMappings()>
>         <cfset mappings[ "mapName1" ] = "D:\inetput\mapdirectory">
>         <cfset this.setMappings( mappings )>
>         ...
>     </cffunction>
> 
> It's generally considered better O-O form to use "set" and 
> "get" methods rather than manipulating attributes directly.
> 
> Vince
> 
> P.S. I'd still probably also define a CFMAPPING tag for 
> people who aren't using Application.cfc for whatever reason. 
> There's no reason both methods for defining 
> application-specific mappings couldn't be supported.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Dawson, Michael
> > Sent: Saturday, October 01, 2005 7:10 PM
> > To: [email protected]
> > Subject: RE: [CFCDev] Java CFCProxy info?
> > 
> > After reading the other related posts, I could also go for 
> > <cfapplicationparam ... /> instead of <cfmapping ... />.
> > 
> > However, in an application.cfc how would you specify mappings?
> > 
> > Hmmm.  How about an array of structs?
> > 
> > <cffunction name="onApplicationStart" ...> <cfscript>
> >   mappings = arrayNew(1);
> >   mappings[1] = structNew();
> >   mappings[1].name = "mapName1";
> >   mappings[1].dirPath = "d:\inetpub\mapdirectory";
> > 
> >   this.mapping = mappings;
> > ...
> > </cfscript>
> > </cffunction>
> > 
> > M!ke
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Dawson, Michael
> > Sent: Saturday, October 01, 2005 6:01 PM
> > To: [email protected]
> > Subject: RE: [CFCDev] Java CFCProxy info?
> > 
> > I agree. CFMAPPING would be more-flexible than another attribute in 
> > CFAPPLICATION.  If this is finally implemented in CF, I 
> certainly hope 
> > the values allow for dynamic variables and not just 
> hard-coded values.
> > 
> > Bad:
> > 
> > <cfapplication ...>
> >   <cfmapping name="literalTextOnly" 
> > directory="literalDirOnly" /> </cfapplication>
> > 
> > Good:
> > 
> > <cfset mapName1 = variableReadFromFile> <cfset mapDir1 = 
> > variableReadFromFile> <cfset mapName2 = variableReadFromDatabase> 
> > <cfset mapDir2 =
> > variableReadFromDatabase>
> > 
> > <cfapplication ...>b
> >   <cfmapping name="#mapName1#" directory="#mapDir1#" />
> >   <cfmapping name="#mapName2#" directory="#mapDir2#" /> 
> > </cfapplication>
> > 
> > M!ke
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Vince Bonfanti
> > Sent: Friday, September 30, 2005 12:51 PM
> > To: [email protected]
> > Subject: RE: [CFCDev] Java CFCProxy info?
> > 
> > Sorry, Jim, I had missed your earlier email. I think I like 
> the idea 
> > of a new CFMAPPING tag better than redefining the 
> CFAPPLICATION tag to 
> > have a tag body and contain CFAPPLICATIONPARAM tags. The 
> former seems 
> > less radical.
> > 
> > Vince
> >
> 
 




----------------------------------------------------------
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