<?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: What&#8217;s the fuzz about ducktyping?</title>
	<atom:link href="http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/</link>
	<description>Because programming should be fun</description>
	<lastBuildDate>Fri, 10 Sep 2010 17:40:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Frank</title>
		<link>http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/comment-page-1/#comment-19</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Fri, 23 Mar 2007 23:33:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/#comment-19</guid>
		<description>Thanks for the comments guys.

I can imagine ducktyping causing readability problems. Someone who relies too much on ducktyping could easily lose both his mind and the control he has on his own application. In fact, the link that Duck Skeptic put opened my eyes on some issues. In small doses (or just for testing/debugging), I&#039;m still convinced that ducktyping is awesome. But I agree we should be careful of not overusing it. I&#039;m going to experiment more on that to make up my mind.

I also really enjoyed the comment by Nate. Performance might be the catch, you&#039;re right. However, I still ask to be proven that it can make an application run &quot;dog-slow&quot;. =) Of course, I guess it all depends on the level of performance you need. To me, a few milliseconds slower is still acceptable. 

Thanks again for your input!</description>
		<content:encoded><![CDATA[<p>Thanks for the comments guys.</p>
<p>I can imagine ducktyping causing readability problems. Someone who relies too much on ducktyping could easily lose both his mind and the control he has on his own application. In fact, the link that Duck Skeptic put opened my eyes on some issues. In small doses (or just for testing/debugging), I&#8217;m still convinced that ducktyping is awesome. But I agree we should be careful of not overusing it. I&#8217;m going to experiment more on that to make up my mind.</p>
<p>I also really enjoyed the comment by Nate. Performance might be the catch, you&#8217;re right. However, I still ask to be proven that it can make an application run &#8220;dog-slow&#8221;. =) Of course, I guess it all depends on the level of performance you need. To me, a few milliseconds slower is still acceptable. </p>
<p>Thanks again for your input!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duck Skeptic</title>
		<link>http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/comment-page-1/#comment-14</link>
		<dc:creator>Duck Skeptic</dc:creator>
		<pubDate>Fri, 23 Mar 2007 16:06:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/#comment-14</guid>
		<description>There are quite a few things wrong with duck typing, and code readability and maintenance is one of them.  Read this for more details:

http://beust.com/weblog/archives/000269.html</description>
		<content:encoded><![CDATA[<p>There are quite a few things wrong with duck typing, and code readability and maintenance is one of them.  Read this for more details:</p>
<p><a href="http://beust.com/weblog/archives/000269.html" rel="nofollow">http://beust.com/weblog/archives/000269.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dagny</title>
		<link>http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/comment-page-1/#comment-9</link>
		<dc:creator>dagny</dc:creator>
		<pubDate>Thu, 22 Mar 2007 15:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/#comment-9</guid>
		<description>Duck typing is a whole lot like late binding, where the object.method call is evaluated at the moment it is called. What&#039;s very ruby-ish to me is adding a method to an instance of a class, vs adding a method to a class.</description>
		<content:encoded><![CDATA[<p>Duck typing is a whole lot like late binding, where the object.method call is evaluated at the moment it is called. What&#8217;s very ruby-ish to me is adding a method to an instance of a class, vs adding a method to a class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/comment-page-1/#comment-8</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Thu, 22 Mar 2007 12:45:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyfleebie.com/whats-the-fuzz-about-ducktyping/#comment-8</guid>
		<description>The catch is performance. Strong typing (including languages that do type inference, like Haskell) allow for compile-time binding to methods. This can allow for the actual call to the method to be decomposed a single JMP instruction. I&#039;m not familiar with Ruby&#039;s implementation of duck-typing specifically, but at best it will require a seek through the object&#039;s method table, and at worst, it will require an operation on the level of reflection -- which is essentially what you&#039;re doing with the respond_to? statement, if I&#039;m not mistaken.

There&#039;s nothing WRONG with duck-typing, per se, but it trades off cpu cycles for programmer cycles. They said the same things about C vs. assembly, though, of course... :) Software engineering is all about understanding costs of certain actions, so as long as you recognize the cost of duck typing, then there&#039;s no real problem with using it. (Although, Ruby doesn&#039;t give you much of a choice...)

Beyond performance, my major issue with duck-typing and Ruby in particular is that it destroys the clarity that you get when using a strongly-typed language (say C#). In C#, if an object extends a given supertype or implements a given interface, it&#039;s asserting that it supports the functionality of that subtype/interface. Said another way, an instance of the subtype IS an instance of the supertype. (This is referred to as the Liskov Substitution Principle.) Inheritance can be thought of as a contractual relationship between the inheriting type and any external code that consumes it -- the type is offering a guarantee that it supports the functionality of the supertype.

With Ruby, you don&#039;t get the same guarantees, since the contractual assertions are moved from the type level to the method level. All you&#039;re REALLY doing is delaying the contractual checks from compile-time to run-time. This certainly makes it easier to write an application the first time, but it significantly raises the overall complexity of the project, making the application more difficult to maintain in the future. Not to mention making it run dog-slow... or is that duck-slow? :)

Just my opinion!</description>
		<content:encoded><![CDATA[<p>The catch is performance. Strong typing (including languages that do type inference, like Haskell) allow for compile-time binding to methods. This can allow for the actual call to the method to be decomposed a single JMP instruction. I&#8217;m not familiar with Ruby&#8217;s implementation of duck-typing specifically, but at best it will require a seek through the object&#8217;s method table, and at worst, it will require an operation on the level of reflection &#8212; which is essentially what you&#8217;re doing with the respond_to? statement, if I&#8217;m not mistaken.</p>
<p>There&#8217;s nothing WRONG with duck-typing, per se, but it trades off cpu cycles for programmer cycles. They said the same things about C vs. assembly, though, of course&#8230; :) Software engineering is all about understanding costs of certain actions, so as long as you recognize the cost of duck typing, then there&#8217;s no real problem with using it. (Although, Ruby doesn&#8217;t give you much of a choice&#8230;)</p>
<p>Beyond performance, my major issue with duck-typing and Ruby in particular is that it destroys the clarity that you get when using a strongly-typed language (say C#). In C#, if an object extends a given supertype or implements a given interface, it&#8217;s asserting that it supports the functionality of that subtype/interface. Said another way, an instance of the subtype IS an instance of the supertype. (This is referred to as the Liskov Substitution Principle.) Inheritance can be thought of as a contractual relationship between the inheriting type and any external code that consumes it &#8212; the type is offering a guarantee that it supports the functionality of the supertype.</p>
<p>With Ruby, you don&#8217;t get the same guarantees, since the contractual assertions are moved from the type level to the method level. All you&#8217;re REALLY doing is delaying the contractual checks from compile-time to run-time. This certainly makes it easier to write an application the first time, but it significantly raises the overall complexity of the project, making the application more difficult to maintain in the future. Not to mention making it run dog-slow&#8230; or is that duck-slow? :)</p>
<p>Just my opinion!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
