I think the primary reason for using get/set is to extract the specific
variable from the larger picture. This way, if something even happens to
your code and you change the source location of the variable's value, you
only have to change it in one place.

I personally don't use get/set as I don't see much value in it, but then I'm
self taught and OO isn't really a big concern for me ATM. I can easily see
this changing over time though. 

-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 23, 2008 11:46 AM
To: CF-Talk
Subject: Why do I need getters/setters?

I'm just not understanding why I'd need a getter and a setter in my cfc. 

My app works just fine without setting anything in the variables scope of my
cfcs. You submit a form, it adds the values to my db. You run a query and
get all the values back out. 

What is the value of keeping each value in its own variables scoped
variable? Where does it come in handy? Where are you supposed to use it? 

Here's a few lines from the legacy samples. 

<cffunction name="setLastName" access="public" output="false">
        <cfargument name="lastName" type="string" required="true" />
        <cfset variables.lastName = arguments.lastName /> </cffunction>
<cffunction name="getLastName" access="public" returntype="string"
output="false">
  <cfreturn variables.lastName />
</cffunction>

Guess I'm missing something since I don't have an OO background. Googled a
little but still confused. 

Thanks,
Will 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307974
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to