<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Duck Typing Dichotomy</title>
	<atom:link href="http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/feed/" rel="self" type="application/rss+xml" />
	<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/</link>
	<description>Web Development and Such......</description>
	<lastBuildDate>Fri, 13 Apr 2007 17:55:27 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: besthealthcare</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-151</link>
		<dc:creator>besthealthcare</dc:creator>
		<pubDate>Fri, 13 Apr 2007 17:55:27 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-151</guid>
		<description>Hello Everyone</description>
		<content:encoded><![CDATA[<p>Hello Everyone</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky Clarkson</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-18</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Tue, 18 Jul 2006 14:00:51 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-18</guid>
		<description>Duck typing is possible in Java, depending on your definition of duck typing.  The original definition by David Thomas fits the Java case pretty well.

http://rickyclarkson.blogspot.com/2006/07/duck-typing-in-java-and-no-reflection.html</description>
		<content:encoded><![CDATA[<p>Duck typing is possible in Java, depending on your definition of duck typing.  The original definition by David Thomas fits the Java case pretty well.</p>
<p><a href="http://rickyclarkson.blogspot.com/2006/07/duck-typing-in-java-and-no-reflection.html" rel="nofollow">http://rickyclarkson.blogspot.com/2006/07/duck-typing-in-java-and-no-reflection.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Loch</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-17</link>
		<dc:creator>Zach Loch</dc:creator>
		<pubDate>Tue, 11 Jul 2006 22:03:45 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-17</guid>
		<description>Great point.  I also store the objects name (or type) in a variable within the object for that specific reason.  If I need to know the objects type I just ask it.  I like the base component idea - I&#039;ll have to experiment with that.

I&#039;m suprised how many people say that they frown on duck typing because of a Java background - introspection is a key component in Java - for instance, when pulling something off of a Vector you commonly have to find its type to work with it.  If the object isn&#039;t the type you want to work with you keep searching through the Vector - very common technique.</description>
		<content:encoded><![CDATA[<p>Great point.  I also store the objects name (or type) in a variable within the object for that specific reason.  If I need to know the objects type I just ask it.  I like the base component idea &#8211; I&#8217;ll have to experiment with that.</p>
<p>I&#8217;m suprised how many people say that they frown on duck typing because of a Java background &#8211; introspection is a key component in Java &#8211; for instance, when pulling something off of a Vector you commonly have to find its type to work with it.  If the object isn&#8217;t the type you want to work with you keep searching through the Vector &#8211; very common technique.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hal Helms</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-16</link>
		<dc:creator>Hal Helms</dc:creator>
		<pubDate>Tue, 11 Jul 2006 21:02:46 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-16</guid>
		<description>I do advocate the use of a base type, but certainly not a &quot;kitchen sink&quot; approach. Rather the base class should be an abstract class that has methods that ALL CFCs should have. One example is the idea of identity so that I can tell one instance of a CFC apart from another instance. 

Is such a thing useful? Let&#039;s see. If I have an array of objects and wish to remove a specific object from the array, how can I do this? I can&#039;t loop over the array, asking if the object I want to remove EQ the current object in the loop. CF will error out if I try this. 

Although some people never find themselves in this situation according to their blogs, I find myself very often in such a situation. To me, the idea of object identity should be baked into every instance, so my base Object class has a unique ID created when the object is instantiated. I then create an equalTo method in Object.cfc that accepts a CFC and checks to see if it&#039;s ID matches the argument&#039;s ID. All CFCs that would normally not extend a CFC then extend Object.cfc (which I place in the CustomTags directory).

This is certainly not an orginal idea of mine. Picasso once said that good artists borrow, but great artists steal. Let&#039;s just say I &quot;liberated&quot; the idea from Java. 

Since I advocate duck typing (and am therefore not concerned with the type of an argument or a returntype), I also created universal &quot;get&quot; and &quot;set&quot; methods that receive an argument (x) and check to see if an actual getX or setX method exists. If it does, the universal get or set calls the specific getX or setX method. If no specific getX or setX method exists, the universal get or set references an instance variable, x. 

These seem to me good examples of the usefulness of a universal base class. I&#039;ve certainly seen the idea of a universal base class abused, with people placing things like persistence in the base class (truly a kitchen sink approach), but that is something I would discourage.</description>
		<content:encoded><![CDATA[<p>I do advocate the use of a base type, but certainly not a &#8220;kitchen sink&#8221; approach. Rather the base class should be an abstract class that has methods that ALL CFCs should have. One example is the idea of identity so that I can tell one instance of a CFC apart from another instance. </p>
<p>Is such a thing useful? Let&#8217;s see. If I have an array of objects and wish to remove a specific object from the array, how can I do this? I can&#8217;t loop over the array, asking if the object I want to remove EQ the current object in the loop. CF will error out if I try this. </p>
<p>Although some people never find themselves in this situation according to their blogs, I find myself very often in such a situation. To me, the idea of object identity should be baked into every instance, so my base Object class has a unique ID created when the object is instantiated. I then create an equalTo method in Object.cfc that accepts a CFC and checks to see if it&#8217;s ID matches the argument&#8217;s ID. All CFCs that would normally not extend a CFC then extend Object.cfc (which I place in the CustomTags directory).</p>
<p>This is certainly not an orginal idea of mine. Picasso once said that good artists borrow, but great artists steal. Let&#8217;s just say I &#8220;liberated&#8221; the idea from Java. </p>
<p>Since I advocate duck typing (and am therefore not concerned with the type of an argument or a returntype), I also created universal &#8220;get&#8221; and &#8220;set&#8221; methods that receive an argument (x) and check to see if an actual getX or setX method exists. If it does, the universal get or set calls the specific getX or setX method. If no specific getX or setX method exists, the universal get or set references an instance variable, x. </p>
<p>These seem to me good examples of the usefulness of a universal base class. I&#8217;ve certainly seen the idea of a universal base class abused, with people placing things like persistence in the base class (truly a kitchen sink approach), but that is something I would discourage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Haskell</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-15</link>
		<dc:creator>Adam Haskell</dc:creator>
		<pubDate>Fri, 07 Jul 2006 15:17:20 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-15</guid>
		<description>Thanks for the welcome Dave! 

I started a repsonse and found it to be a little long so I posted an entry:

http://cfrant.blogspot.com/2006/07/one-last-piece-on-duck-typing-then-i.html</description>
		<content:encoded><![CDATA[<p>Thanks for the welcome Dave! </p>
<p>I started a repsonse and found it to be a little long so I posted an entry:</p>
<p><a href="http://cfrant.blogspot.com/2006/07/one-last-piece-on-duck-typing-then-i.html" rel="nofollow">http://cfrant.blogspot.com/2006/07/one-last-piece-on-duck-typing-then-i.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Carabetta</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-14</link>
		<dc:creator>Dave Carabetta</dc:creator>
		<pubDate>Fri, 07 Jul 2006 14:31:54 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-14</guid>
		<description>Zach,

Agreed. However, using your example, I&#039;d argue that the &quot;specialty projects&quot; are the equivalent of an &quot;advanced technique&quot; in ColdFusion. That was the point I was trying to make; don&#039;t blindly remove typing because the other voices in the community have advocated it. Further, I did not mean to imply that frameworks were the *only* place to use duck typing. Rather, I submitted that, to date, in all the ColdFusion code samples I&#039;ve seen posted, the framework-related code posted by both Joe and Sean on their blogs have been the most pragmatic uses. I certainly have seen the &quot;hello world&quot; examples of duck typing, but nobody has posted &quot;real world&quot; code that shows why they used duck typing to solve a particular problem...even your Plane/Car example is merely a learning example, not actually implemented.

Great discussion.</description>
		<content:encoded><![CDATA[<p>Zach,</p>
<p>Agreed. However, using your example, I&#8217;d argue that the &#8220;specialty projects&#8221; are the equivalent of an &#8220;advanced technique&#8221; in ColdFusion. That was the point I was trying to make; don&#8217;t blindly remove typing because the other voices in the community have advocated it. Further, I did not mean to imply that frameworks were the *only* place to use duck typing. Rather, I submitted that, to date, in all the ColdFusion code samples I&#8217;ve seen posted, the framework-related code posted by both Joe and Sean on their blogs have been the most pragmatic uses. I certainly have seen the &#8220;hello world&#8221; examples of duck typing, but nobody has posted &#8220;real world&#8221; code that shows why they used duck typing to solve a particular problem&#8230;even your Plane/Car example is merely a learning example, not actually implemented.</p>
<p>Great discussion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Loch</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-13</link>
		<dc:creator>Zach Loch</dc:creator>
		<pubDate>Fri, 07 Jul 2006 04:10:17 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-13</guid>
		<description>Dave and Skeptic Sam,

You make some valid points.  

I see duck typing as a tool in our development toolbox.  For example, a construction worker could build a house with only a hammer, some nails, and some type of saw.  And people have done that just fine for many, many years.  However, most homebuilders now have huge trailers filled with hundreds of tools that they take with them on job sites.  Many of those tools are considered &#039;specialty&#039; tools and only get used a couple times a year.  Of course, some builders work only &#039;specialty&#039; projects and use them more often but everyone uses them sometime or another.

The point is these &#039;specialty&#039; type tools are not necessarily *needed*, we&#039;ve been developing just fine for a long time without them (this wasn&#039;t even an issue in CF5 and earlier).  However, we would be hindering ourselves by not using these new tools to provide more effecient and elegant solutions.  I don&#039;t think we should apply a liberal brush and take typing information out entirely, but to say that only frameworks could use this solution is equally as wrong in my point of view (unless you are working on trivial projects).</description>
		<content:encoded><![CDATA[<p>Dave and Skeptic Sam,</p>
<p>You make some valid points.  </p>
<p>I see duck typing as a tool in our development toolbox.  For example, a construction worker could build a house with only a hammer, some nails, and some type of saw.  And people have done that just fine for many, many years.  However, most homebuilders now have huge trailers filled with hundreds of tools that they take with them on job sites.  Many of those tools are considered &#8217;specialty&#8217; tools and only get used a couple times a year.  Of course, some builders work only &#8217;specialty&#8217; projects and use them more often but everyone uses them sometime or another.</p>
<p>The point is these &#8217;specialty&#8217; type tools are not necessarily *needed*, we&#8217;ve been developing just fine for a long time without them (this wasn&#8217;t even an issue in CF5 and earlier).  However, we would be hindering ourselves by not using these new tools to provide more effecient and elegant solutions.  I don&#8217;t think we should apply a liberal brush and take typing information out entirely, but to say that only frameworks could use this solution is equally as wrong in my point of view (unless you are working on trivial projects).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Carabetta</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-12</link>
		<dc:creator>Dave Carabetta</dc:creator>
		<pubDate>Thu, 06 Jul 2006 15:35:03 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-12</guid>
		<description>Skeptic Sam, yes, that&#039;s exactly what I&#039;m saying. People like to say that ColdFusion isn&#039;t Java. I would correct that statement and say ColdFusion isn&#039;t Java *conceptually*. Well, you know what? ColdFusion isn&#039;t Ruby, Python, C#, or any other language either. It has it&#039;s own strong points, weak points, and all points in between, as do the other languages. To that end, I think it&#039;s apples to oranges to compare duck typing between languages. ColdFusion doesn&#039;t optimize the same as Ruby, which doesn&#039;t optimize the same as Python. Perhaps duck typing might make sense in those languages. But as a 10-year veteran of ColdFusion development, I&#039;ve yet to come across a situation in my work where duck typing was the best solution to a problem statement. (I don&#039;t write frameworks, which is really the only place that I&#039;ve seen the justification for this technique so far.)</description>
		<content:encoded><![CDATA[<p>Skeptic Sam, yes, that&#8217;s exactly what I&#8217;m saying. People like to say that ColdFusion isn&#8217;t Java. I would correct that statement and say ColdFusion isn&#8217;t Java *conceptually*. Well, you know what? ColdFusion isn&#8217;t Ruby, Python, C#, or any other language either. It has it&#8217;s own strong points, weak points, and all points in between, as do the other languages. To that end, I think it&#8217;s apples to oranges to compare duck typing between languages. ColdFusion doesn&#8217;t optimize the same as Ruby, which doesn&#8217;t optimize the same as Python. Perhaps duck typing might make sense in those languages. But as a 10-year veteran of ColdFusion development, I&#8217;ve yet to come across a situation in my work where duck typing was the best solution to a problem statement. (I don&#8217;t write frameworks, which is really the only place that I&#8217;ve seen the justification for this technique so far.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Petruzzi</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-11</link>
		<dc:creator>Tony Petruzzi</dc:creator>
		<pubDate>Thu, 06 Jul 2006 15:25:32 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-11</guid>
		<description>@sean,

&quot;As for documentation, anyone who isn’t use hint= on every cfcomponent, cffunction and cfargument needs to be lined up against the wall…&quot;

Sorry, but with proper typing (there it is again), coding (the one function for one thing) and naming of your functions and arguments (using &quot;x&quot; as a variable name isn&#039;t good practice), you don&#039;t need be wasting your time with putting hints onto every component, function and argument.</description>
		<content:encoded><![CDATA[<p>@sean,</p>
<p>&#8220;As for documentation, anyone who isn’t use hint= on every cfcomponent, cffunction and cfargument needs to be lined up against the wall…&#8221;</p>
<p>Sorry, but with proper typing (there it is again), coding (the one function for one thing) and naming of your functions and arguments (using &#8220;x&#8221; as a variable name isn&#8217;t good practice), you don&#8217;t need be wasting your time with putting hints onto every component, function and argument.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trond Ulseth</title>
		<link>http://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-10</link>
		<dc:creator>Trond Ulseth</dc:creator>
		<pubDate>Thu, 06 Jul 2006 08:29:18 +0000</pubDate>
		<guid isPermaLink="false">https://zachloch.wordpress.com/2006/07/04/duck-typing-dichotomy/#comment-10</guid>
		<description>Zach, thank you for this post. I always enjoy posts which get me a little closer to understanding some consept.</description>
		<content:encoded><![CDATA[<p>Zach, thank you for this post. I always enjoy posts which get me a little closer to understanding some consept.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
