Hi Ken,

Just to clarify terminology, what's a memento? I'm guessing that I'd call it
a pointer (the get and set functions).

Dan 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ken Dunnington
> Sent: Wednesday, November 10, 2004 12:13 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [CFCDev] How to define a property on a CFC
> 
> Just to clarify, the 'this' scope is available to the calling page of 
> the CFC. The 'variables' scope (used inside the CFC) is not. You can 
> use a memento to get all of the variables out of the CFC (or even a 
> subset of the variables, it's up to you.) Either way, using internal 
> variables might require more work up front, but the advantages of 
> encapsulation will quickly pay for themselves.
> 
> Also, if you use a bean generator, be sure to proofread your 
> code! Bean 
> generators are good starting points, but should never be relied upon 
> for final code. :)
> 
> On Nov 10, 2004, at 2:50 PM, Daniel Short wrote:
> 
> > Gotcha, that makes sense :). I'm used to Get, Set and Let 
> in VBScript
> > objects, just seemed odd to write methods to get and set variables. 
> > Gotta
> > twist my brain to a new way of thinking in this case.
> >
> > Dan
> >
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] On Behalf Of Barney Boisvert
> >> Sent: Wednesday, November 10, 2004 10:27 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: Re: [CFCDev] How to define a property on a CFC
> >>
> >> I'd consider it bad, because any code can modify variables 
> in the THIS
> >> scope.  Generally much better to use a getter, though there are
> >> certainly exceptions.
> >>
> >> If you do use 'this', then you need to make sure that your CFC's
> >> internal workings don't depend on the value, because there's no
> >> guarentee that it'll be what it "should" be.
> >>
> >> cheers,
> >> barneyb
> >>
> >> On Wed, 10 Nov 2004 10:19:59 -0800, Daniel Short
> >> <[EMAIL PROTECTED]> wrote:
> >>> That seems like an inordinate amount of code for just
> >> setting and returning
> >>> properties. I decided to play with the THIS scope, and came
> >> up with this:
> >>>
> >>> <cfcomponent>
> >>>
> >>>        <cffunction name="init">
> >>>                <cfset THIS.hasError = false>
> >>>        </cffunction>
> >>>
> >>>        <cffunction name="mymethod">
> >>>                <cftry>
> >>>                        <!--- some bad code --->
> >>>                        <cfcatch>
> >>>                                <cfset THIS.hasError = true>
> >>>                        </cfcatch>
> >>>                <cftry>
> >>>        </cffunction>
> >>> </cfcomponent>
> >>>
> >>> Then in the calling page, I have this:
> >>>
> >>> <cfobject component="cfc/mycfc" name="mycfc">
> >>> <cfinvoke component="#mycfc#" method="init">
> >>> <cfinvoke component="#mycfc#" method="mymethod">
> >>> <cfoutput>#mycfc.hasError#</cfoutput>
> >>>
> >>> Am I doing anything illegal or bad there? I had heard that
> >> the THIS scope
> >>> was available outside the CFC, but I assumed that meant via
> >> the THIS scope,
> >>> which I found to be not true. Just trying to figure out if
> >> I might run into
> >>> a problem I'm not seeing by doing things this way.
> >>>
> >>> Thanks,
> >>>
> >>> Dan
> >>>
> >> -- 
> >> Barney Boisvert
> >> [EMAIL PROTECTED]
> >> 360.319.6145
> >> http://www.barneyb.com/blog/
> >>
> >> I currently have 0 GMail invites for the taking
> >> ----------------------------------------------------------
> >> 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
> >> [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 
> > [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 
> [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 
[EMAIL PROTECTED]

Reply via email to