<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>
<channel>
	<title>Comments on: Feature or Bug, You Decide: Argument Reordering in Groovy</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/groovy-argument-reordering/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/groovy-argument-reordering/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Tue, 09 Mar 2010 23:06:00 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-argument-reordering/#comment-33692</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Wed, 20 Aug 2008 03:19:34 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=758#comment-33692</guid>
		<description>By rearranging the arguments, you can play fast-and-loose with your API.  For instance, I could call custom(class, prop1:&quot;val1&quot;, prop2:&quot;val2&quot;), or I could call custom(prop1:&quot;val1&quot;, prop2:&quot;val2&quot;, class).

This actually makes life easier for people constructing builders, because you can specify &quot;required&quot; values, allow the user to put the map where they like, and collect everything that&#039;s left as varargs.

To allow that kind of flexibility through the traditional Java API would require a plethora of carefully-wired methods.  Given defaulted parameters, it&#039;s actually clearer to the developer and easier on the user to allow the flexibility.  And, of course, if you&#039;re the user and you want to be anal about it, you can always use explicit maps to force the argument order.

Once you get used to the idea, it&#039;s actually pretty nice.  Reminds me a bit of Perl&#039;s pseudohashes, but cooler.

The only thing is that I wish they would enforce the closure constraint if I&#039;m expecting to be passed a block.  It seems like an odd decision to force that into userspace while everything else is taken out up front.</description>
		<content:encoded><![CDATA[<p>By rearranging the arguments, you can play fast-and-loose with your API.  For instance, I could call custom(class, prop1:&#8221;val1&#8243;, prop2:&#8221;val2&#8243;), or I could call custom(prop1:&#8221;val1&#8243;, prop2:&#8221;val2&#8243;, class).</p>
<p>This actually makes life easier for people constructing builders, because you can specify &#8220;required&#8221; values, allow the user to put the map where they like, and collect everything that&#8217;s left as varargs.</p>
<p>To allow that kind of flexibility through the traditional Java API would require a plethora of carefully-wired methods.  Given defaulted parameters, it&#8217;s actually clearer to the developer and easier on the user to allow the flexibility.  And, of course, if you&#8217;re the user and you want to be anal about it, you can always use explicit maps to force the argument order.</p>
<p>Once you get used to the idea, it&#8217;s actually pretty nice.  Reminds me a bit of Perl&#8217;s pseudohashes, but cooler.</p>
<p>The only thing is that I wish they would enforce the closure constraint if I&#8217;m expecting to be passed a block.  It seems like an odd decision to force that into userspace while everything else is taken out up front.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://enfranchisedmind.com/blog/posts/groovy-argument-reordering/#comment-33691</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Tue, 19 Aug 2008 20:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=758#comment-33691</guid>
		<description>I read the JIRA tickets and the documentation, but I&#039;m failing to see why this reordering is a good thing.  What am I missing?  Why do you like it?</description>
		<content:encoded><![CDATA[<p>I read the JIRA tickets and the documentation, but I&#8217;m failing to see why this reordering is a good thing.  What am I missing?  Why do you like it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
