Typically if you are doing manipulation of the value, you don't want to alter 
the input value, but rather a copy of it. 

<Cfset var firstName = Trim(arguments.firstname) />
Vs 
<Cfset arguments.firstName = Trim(arguments.firstname) />

If you're not manipulating it further, then it might be a bit redundant at 
first:

<Cfset var localfirstName = arguments.firstname />
 
But by writing it this way, you make sure that if further down the road, if you 
find out that whitespace is being added to the end of certain firstnames, and 
you want to add the trim operation, you don't have to add it for every 
reference to arguments.firstname.  

So it's a best practice in that it allows you for more maintainable code. 


Terrence Ryan
Senior Systems Programmer
Wharton Computing and Information Technology
E-mail:         [EMAIL PROTECTED]
 

-----Original Message-----
From: Victor Moore [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 10:54 AM
To: CF-Talk
Subject: CFC question

Hi,

I have seen in a number of examples the following:

<cfset variables.myVar = arguments.someArg /> any particular reason/advantage 
why the arguments are assigned to a local variable inside a cfc function 
instead of using it directly?

Thanks
Victor




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252990
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