Use an arguments collection or name arguments so the order doesn¹t matter.
Typically when you have more than 2-3 arguments for a method call you want
to look at named arguments or arguments collections otherwise your code
becomes hard to read and hard to maintain.

Best Wishes,
Peter


On 7/2/07 9:05 PM, "Casey Dougall" <[EMAIL PROTECTED]> wrote:

> On 7/2/07, Nando <[EMAIL PROTECTED]> wrote:
>>  
>> 
>> <cfcomponent displayName="List" hint="I'm a List that belongs to a certain
>> User" output="false">
>>     
>>     <cffunction name="init" access="public" output="false">
>>         <cfargument name="ListID" type="string" required="false" default=""
>> />
>>         <cfargument name="UserID" type="string" required="false" default=""
>> />
>>         <cfargument name="ListName" type="string" required="false" default=""
>> />
>>         <cfset setListID(arguments.ListID) />
>>         <cfset setUserID(arguments.UserID) />
>>         <cfset setListName(arguments.ListName) />
>>         <cfreturn this />
>>      </cffunction>
> 
> 
> I'm not a OO guy myself but found it interesting as anything at cfunited. My
> question about the above deals about changing the order of arguments. I
> haven't see anything that really deals with this and I would think this is one
> of the biggest challenges with anything using components and at some point
> adding on to an application from somewhere in the middle.
> 
> Using the example above, a few months down the line you need to access this
> list not by ListID, but by ListCategoryID. Now where this may be the last
> argument used, is this the best way to go about designing cffunctions? I'd
> like to put ListCategoryID first without messing up my scripts that depend on
> ListID being first. What's the best way to handle this?
> 
> 
> You are subscribed to cfcdev. To unsubscribe, please follow the instructions
> at http://www.cfczone.org/listserv.cfm
> 
> CFCDev is supported by:
> Katapult Media, Inc.
> We are cool code geeks looking for fun projects to rock!
> www.katapultmedia.com
> 
> An archive of the CFCDev list is available at
> www.mail-archive.com/cfcdev@cfczone.org




You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org

Reply via email to