I would use the getters and setters inside the component.

for instance, say i'm keeping track of someones birthdate in the
component and when I call the setDoB() method I do more than just
write variables.instance.dob = arguments.dob.  I might also format the
date andmake sure it is a valid date.

Now, if I have some other method that accesses the
variables.instance.dob I don't want to have to write that formatting
and validation logic again so I should be calling setDoB whenever I
want to change it's value.

Likewise any time I want the person's age I shoudl call getAge and not
access variables.instance.age directly.  Why? Well first of, what If I
stop storing age and start calculating it dynamically? IF I am calling
getAge() then I don't care where the age is coming from (a property or
a calculation) I just know I will always have the age.

You've defined an interface with you're getters and setters, and
personally, I think you should stick to that contract regardless if
you are in or out of the component.  It provides consistency and makes
maintenance easier IMO.


Bill


On 10/12/05, Dawson, Michael <[EMAIL PROTECTED]> wrote:
> When inside a component, you don't use "this.getName()".  You only need
> to use "getName()".
>
> M!ke
>
> ---------------
>
> <cffunction name="getMyThingsWithGetter">
>         <cfset local=structnew()>
>         <cfquery name="local.qryMyThings">
>                 Select *
>                 From Things
>                 Where name='#this.getName()#'
>         </cfquery>
>         <cfreturn local.qryMyThings>
> </cffunction>
> </cfcomponent>
>
>
> ----------------------------------------------------------
> 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]
>
>
>


--
[EMAIL PROTECTED]
http://blog.rawlinson.us

If you want Gmail - just ask.


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