<?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/"
		>
<channel>
	<title>Comments on: Groovy Objects in CFML (a la Ben)</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ben Nadel</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191864</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 24 Sep 2009 12:57:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191864</guid>
		<description>I&#039;ve been trying to play around with Groovy, but I feel so handicap because I am trying to, perhaps, get too dynamic without truly knowing much about the language. Everything in CF is so easy, it seems, but I guess it&#039;s just that I don&#039;t know the syntax in Groovy yet. 

This morning, I tried to play around with two ideas that stopped me dead in my tracks:

1. Extending CF classes
2. Overwriting cast operators

1 - its seems that a lot of the CF classes are considered &quot;final&quot;?? and Groovy will not let me extend them. :(

2 - this might just be something that is not possible across the groovy / cf context. Plus, I probably don&#039;t have the correct syntax. 

... sorry, I know this comment is a total non-sequitur.</description>
		<content:encoded><![CDATA[<p>I've been trying to play around with Groovy, but I feel so handicap because I am trying to, perhaps, get too dynamic without truly knowing much about the language. Everything in CF is so easy, it seems, but I guess it's just that I don't know the syntax in Groovy yet. </p>
<p>This morning, I tried to play around with two ideas that stopped me dead in my tracks:</p>
<p>1. Extending CF classes<br />
2. Overwriting cast operators</p>
<p>1 &#8211; its seems that a lot of the CF classes are considered "final"?? and Groovy will not let me extend them. :(</p>
<p>2 &#8211; this might just be something that is not possible across the groovy / cf context. Plus, I probably don't have the correct syntax. </p>
<p>&#8230; sorry, I know this comment is a total non-sequitur.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191804</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Wed, 23 Sep 2009 19:35:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191804</guid>
		<description>Ah, I misread you, sorry. Again, I don&#039;t think Groovy&#039;s missingMethod() is slow per se but what you then do in order to process the &#039;missing&#039; method call may well be slow. Of course, in Groovy it can optimize &#039;regular&#039; method calls down to native Java calls so compared to that, both Groovy&#039;s missingMethod() and *any* of CFML&#039;s method calls are slow since they look a lookup and, potentially, reflection...</description>
		<content:encoded><![CDATA[<p>Ah, I misread you, sorry. Again, I don't think Groovy's missingMethod() is slow per se but what you then do in order to process the 'missing' method call may well be slow. Of course, in Groovy it can optimize 'regular' method calls down to native Java calls so compared to that, both Groovy's missingMethod() and *any* of CFML's method calls are slow since they look a lookup and, potentially, reflection&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191693</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Tue, 22 Sep 2009 21:02:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191693</guid>
		<description>@Sean,

I was saying that onMissingMethod() was *not* slow. In fact, I think I was actually thinking of a conversation that you and I had (online) in regards to that. I was saying that I was surprised that Groovy&#039;s missingMethod() was considered slow, since CF&#039;s was considered fast.</description>
		<content:encoded><![CDATA[<p>@Sean,</p>
<p>I was saying that onMissingMethod() was *not* slow. In fact, I think I was actually thinking of a conversation that you and I had (online) in regards to that. I was saying that I was surprised that Groovy's missingMethod() was considered slow, since CF's was considered fast.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191689</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Tue, 22 Sep 2009 20:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191689</guid>
		<description>Where did you read that onMissingMethod() was slow? The actual invocation is very fast because it&#039;s built right into the function lookup so it adds only a few ms to the call. Of course, performance depends on what you do *inside* onMissingMethod() ...

I&#039;ve used onMissingMethod() very successfully to provide automatic delegation across tiers in an application as well as generic CRUD methods which cuts out huge amounts of boilerplate code. Yes, there&#039;s an overhead in the logic *inside* oMM() that decodes what the method should do and how to process the &#039;real&#039; call but in the grand scale of things the RAD benefits overwhelmed that completely for Phase I of a project...</description>
		<content:encoded><![CDATA[<p>Where did you read that onMissingMethod() was slow? The actual invocation is very fast because it's built right into the function lookup so it adds only a few ms to the call. Of course, performance depends on what you do *inside* onMissingMethod() &#8230;</p>
<p>I've used onMissingMethod() very successfully to provide automatic delegation across tiers in an application as well as generic CRUD methods which cuts out huge amounts of boilerplate code. Yes, there's an overhead in the logic *inside* oMM() that decodes what the method should do and how to process the 'real' call but in the grand scale of things the RAD benefits overwhelmed that completely for Phase I of a project&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191324</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 17 Sep 2009 22:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191324</guid>
		<description>I honestly don&#039;t know.  I&#039;d expect missingMethod to be significantly slower than a &quot;real&quot; method invocation, but with how much faster Groovy operations are than CFML ones, I really can&#039;t say if it&#039;s relevant.  If a real method call takes 5 nanoseconds, and a missingMethod call takes 500 nanoseconds, that&#039;s 100 times slower.  But if a normal CF method call also takes 500 nanoseconds, then Groovy&#039;s missingMethod is &lt;i&gt;fast&lt;/i&gt;.  Those numbers are completely baseless, they&#039;re merely for illustrative purposes.  You&#039;d have to do testing to see if the performance actually mattered.</description>
		<content:encoded><![CDATA[<p>I honestly don't know.  I'd expect missingMethod to be significantly slower than a "real" method invocation, but with how much faster Groovy operations are than CFML ones, I really can't say if it's relevant.  If a real method call takes 5 nanoseconds, and a missingMethod call takes 500 nanoseconds, that's 100 times slower.  But if a normal CF method call also takes 500 nanoseconds, then Groovy's missingMethod is <i>fast</i>.  Those numbers are completely baseless, they're merely for illustrative purposes.  You'd have to do testing to see if the performance actually mattered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191323</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 17 Sep 2009 22:45:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191323</guid>
		<description>I was looking up missingMethod and some articles said that it was very slow. Is this true? I only ask because in the CF world, it has been explained that since CF checks for the target method before sending the message to OnMissingMethod(), it actually has almost no overhead (and no exception handling). Does Groovy work differently? Or, is the &quot;slow&quot; that Groovy is talking about relative?</description>
		<content:encoded><![CDATA[<p>I was looking up missingMethod and some articles said that it was very slow. Is this true? I only ask because in the CF world, it has been explained that since CF checks for the target method before sending the message to OnMissingMethod(), it actually has almost no overhead (and no exception handling). Does Groovy work differently? Or, is the "slow" that Groovy is talking about relative?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191304</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 17 Sep 2009 18:36:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191304</guid>
		<description>Yeah, you&#039;re right.  It&#039;s actually a compiler hack that does it, not a runtime features, and CF doesn&#039;t have it.  E.g. when you write myVarargsMethod(1, 2, 3, 4), it actually compiles down to the equivalent of myVarargsMethod([1, 2, 3, 4].toArray()), so at runtime it&#039;s actually a single Object[] that is passed to the method.  CF can&#039;t do that because it&#039;s reflection support is apparently still in Java 1.4 land.

You could use missingMethod to implement your init() method; then you&#039;ll get the arguments as a collection along with the method name.</description>
		<content:encoded><![CDATA[<p>Yeah, you're right.  It's actually a compiler hack that does it, not a runtime features, and CF doesn't have it.  E.g. when you write myVarargsMethod(1, 2, 3, 4), it actually compiles down to the equivalent of myVarargsMethod([1, 2, 3, 4].toArray()), so at runtime it's actually a single Object[] that is passed to the method.  CF can't do that because it's reflection support is apparently still in Java 1.4 land.</p>
<p>You could use missingMethod to implement your init() method; then you'll get the arguments as a collection along with the method name.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191303</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 17 Sep 2009 18:20:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191303</guid>
		<description>Actually, I think I read that link this morning! I think there is a problem - the variable arguments seemed to work perfectly fine from within Groovy; but, I think when called from ColdFusion:



... I was method signature errors that CF was trying to find this:

method( Object[] )

It looks like within the Groovy context, N methods =&gt; Object[] args happens implicitly; but, when going from CF to Groovy, you need to explicitly define the collection.

Of course, again, I am new - I might very well be way off here. But, that&#039;s why I went with the 10 explicit args rather than (Object... args) notation.</description>
		<content:encoded><![CDATA[<p>Actually, I think I read that link this morning! I think there is a problem &#8211; the variable arguments seemed to work perfectly fine from within Groovy; but, I think when called from ColdFusion:</p>
<p>&#8230; I was method signature errors that CF was trying to find this:</p>
<p>method( Object[] )</p>
<p>It looks like within the Groovy context, N methods =&gt; Object[] args happens implicitly; but, when going from CF to Groovy, you need to explicitly define the collection.</p>
<p>Of course, again, I am new &#8211; I might very well be way off here. But, that's why I went with the 10 explicit args rather than (Object&#8230; args) notation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191302</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Thu, 17 Sep 2009 18:16:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191302</guid>
		<description>Ah, ok, cool. I just figured CFInvoke / CFInvokeArgument was some sort of more elegant dynamic code execution. I&#039;ll be sure to check out that link.

And, again, thanks for the CFUNITED presentation - it was very inspiring.</description>
		<content:encoded><![CDATA[<p>Ah, ok, cool. I just figured CFInvoke / CFInvokeArgument was some sort of more elegant dynamic code execution. I'll be sure to check out that link.</p>
<p>And, again, thanks for the CFUNITED presentation &#8211; it was very inspiring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2009/09/17/groovy-objects-in-cfml-a-la-ben/comment-page-1/#comment-191300</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Thu, 17 Sep 2009 17:46:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1092#comment-191300</guid>
		<description>CFINVOKE and createObject() are both backed by reflection, almost identical to the way you implemented it in your code.  Obviously it supports variable numbers of arguments in a cleaner way (not a list of ten), but the gist of it is identical.  Check out the first example at http://www.javalobby.org/articles/groovy-intro3/ for some goods about variable numbers of arguments.  It&#039;s just as easy (perhaps easier) as with CFML.  :)</description>
		<content:encoded><![CDATA[<p>CFINVOKE and createObject() are both backed by reflection, almost identical to the way you implemented it in your code.  Obviously it supports variable numbers of arguments in a cleaner way (not a list of ten), but the gist of it is identical.  Check out the first example at <a href="http://www.javalobby.org/articles/groovy-intro3/" rel="nofollow">http://www.javalobby.org/articles/groovy-intro3/</a> for some goods about variable numbers of arguments.  It's just as easy (perhaps easier) as with CFML.  :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
