Brian Rinaldi wrote, On 3/8/2007 6:56 PM:
I think using argumentCollection is a completely valid way of doing things. I use it all the time. Why write everything out when you can do things like argumentCollection=form or argumentCollection=url? You'll also find it in my code generator whereby I turn a query row into a struct and init a new bean using argumentCollection. Suffice it to say I use it wherever I can. I think it does a couple of beneficial things, the primary being that when your arguments change you don't need to go around updating your function calls. The second is, it makes handling empty values easier. For instance, let's say you were passing a full name you might say user.init(firstName=firstName,mi=mi,lastName=lastName). However, how do you handle the middle initial (mi) if it isn't defined because it is not required. You could pass an empty string and code your function to check for that, or you could just use argumentCollection. This is actually a poor example, since it works better for numeric and other types where, if you type check your arguments as you should, you can't use empty string as a null equivalent....but I think you get my drift.

Absolutely, I use it for similar reasons as well. But, I don't know that if I was hand-coding things, I would use it quite "so much." A generator or framework is one thing, but daily use and having to think about it is another. It may makes things easy in the short run, but I would think that having to go back over some code a year after you wrote it (or someone being new to it altogether) would be difficult if the code documents itself like that...



--
Brian Rinaldi
blog - http://www.remotesynthesis.com/blog
ColdFusion Open Source List- http://www.remotesynthesis.com/cfopensourcelist
Boston CFUG - http://www.bostoncfug.org
Adobe Community Expert - 
http://www.adobe.com/communities/experts/members/brian_rinaldi.html
CFDJ Editorial Board - http://coldfusion.sys-con.com/general/editboard.htm

Dave Watts wrote:
Q: If you have a ton of arguments, is using ArgumentCollection the best practice?

I wouldn't go so far as to say it's a best practice or it's not, but my
personal preference is only to use ArgumentCollection when I might have an
unknown number of arguments.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!



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/[email protected]


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/[email protected]



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/[email protected]

Reply via email to