<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Sustainable Development in Ruby, Part 1: Good Old-Fashioned Inheritance</title>
	<atom:link href="http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/feed/" rel="self" type="application/rss+xml" />
	<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/</link>
	<description>"...the three great virtues of a programmer: laziness, impatience, and hubris." -- Larry Wall</description>
	<lastBuildDate>Wed, 03 Mar 2010 21:56:22 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sustainable Software Development &#124; humandoing software</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-663</link>
		<dc:creator>Sustainable Software Development &#124; humandoing software</dc:creator>
		<pubDate>Thu, 25 Jun 2009 17:01:14 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-663</guid>
		<description>[...] Avdi&#8217;s series on sustainable development in [...]</description>
		<content:encoded><![CDATA[<p>[...] Avdi&#8217;s series on sustainable development in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enfranchised Mind &#187; 7 Actually Useful Things You Didn&#8217;t Know Static Typing Could Do: An Introduction for the Dynamic Language Enthusiast</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-51</link>
		<dc:creator>Enfranchised Mind &#187; 7 Actually Useful Things You Didn&#8217;t Know Static Typing Could Do: An Introduction for the Dynamic Language Enthusiast</dc:creator>
		<pubDate>Mon, 14 Apr 2008 14:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-51</guid>
		<description>[...] This is certainly a leap and a bound beyond global duck punching, where you need to know how every use of that module is going to behave, and then validate that it works out in all those cases. The reality in my experience is that people who pull off global duck punching tend to just kind of pray and hope their unit tests catch any bug they just introduced. This makes me unoptomistic about the maintainability of that code &#8212; and even the Ruby community is starting to agree with me (cite, cite). [...]</description>
		<content:encoded><![CDATA[<p>[...] This is certainly a leap and a bound beyond global duck punching, where you need to know how every use of that module is going to behave, and then validate that it works out in all those cases. The reality in my experience is that people who pull off global duck punching tend to just kind of pray and hope their unit tests catch any bug they just introduced. This makes me unoptomistic about the maintainability of that code &#8212; and even the Ruby community is starting to agree with me (cite, cite). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: This Week in Ruby (April 7, 2008) &#124; Zen and the Art of Programming</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-39</link>
		<dc:creator>This Week in Ruby (April 7, 2008) &#124; Zen and the Art of Programming</dc:creator>
		<pubDate>Mon, 07 Apr 2008 10:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-39</guid>
		<description>[...] Development in Ruby (part 1 and part [...]</description>
		<content:encoded><![CDATA[<p>[...] Development in Ruby (part 1 and part [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virtuous Code &#8250; Sustainable Development in Ruby, Part 2: Method Injection</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-27</link>
		<dc:creator>Virtuous Code &#8250; Sustainable Development in Ruby, Part 2: Method Injection</dc:creator>
		<pubDate>Tue, 01 Apr 2008 02:00:12 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-27</guid>
		<description>[...] fields are marked * Name *  Email *  Website  Comment   add_openid_to_comment_form()     &#8249; Sustainable Development in Ruby, Part 1: Good Old-Fashioned Inheritance      &#169; 2008   &#182; Thanks, WordPress. &#182; veryplaintxt theme by Scott Allan Wallick. [...]</description>
		<content:encoded><![CDATA[<p>[...] fields are marked * Name *  Email *  Website  Comment   add_openid_to_comment_form()     &lsaquo; Sustainable Development in Ruby, Part 1: Good Old-Fashioned Inheritance      &copy; 2008   &para; Thanks, WordPress. &para; veryplaintxt theme by Scott Allan Wallick. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: avdi</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-26</link>
		<dc:creator>avdi</dc:creator>
		<pubDate>Sat, 29 Mar 2008 21:37:26 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-26</guid>
		<description>Pat: I understand your point, but this was the inheritance post :-)  Composition will come later.</description>
		<content:encoded><![CDATA[<p>Pat: I understand your point, but this was the inheritance post <img src='http://avdi.org/devblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   Composition will come later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Maddox</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-25</link>
		<dc:creator>Pat Maddox</dc:creator>
		<pubDate>Sat, 29 Mar 2008 21:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-25</guid>
		<description>I think this is a perfect example of where to prefer composition over inheritance.  I would probably do:

&lt;code&gt;class BufferedReader
  def initialize(connection)
    @connection = connection
  end
  
  def receive
    buffer = &quot;&quot;
    begin
      message = @connection.receive
      buffer &lt;&lt; message.data
    end until(message.data.include?(&quot;ENDENDEND&quot;))
    Message.new(buffer)
  end
end&lt;/code&gt;

This allows you to combine different readers to achieve the behavior you want.  Not only that, but now the buffered reader is generally useful instead of being coupled to the Connection class.</description>
		<content:encoded><![CDATA[<p>I think this is a perfect example of where to prefer composition over inheritance.  I would probably do:</p>
<p><code>class BufferedReader<br />
  def initialize(connection)<br />
    @connection = connection<br />
  end</p>
<p>  def receive<br />
    buffer = &quot;&quot;<br />
    begin<br />
      message = @connection.receive<br />
      buffer &amp;lt;&amp;lt; message.data<br />
    end until(message.data.include?(&quot;ENDENDEND&quot;))<br />
    Message.new(buffer)<br />
  end<br />
end</code></p>
<p>This allows you to combine different readers to achieve the behavior you want.  Not only that, but now the buffered reader is generally useful instead of being coupled to the Connection class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: avdi</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-115</link>
		<dc:creator>avdi</dc:creator>
		<pubDate>Sat, 29 Mar 2008 19:37:26 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-115</guid>
		<description>Pat: I understand your point, but this was the inheritance post :-)  Composition will come later.</description>
		<content:encoded><![CDATA[<p>Pat: I understand your point, but this was the inheritance post <img src='http://avdi.org/devblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   Composition will come later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat Maddox</title>
		<link>http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/comment-page-1/#comment-114</link>
		<dc:creator>Pat Maddox</dc:creator>
		<pubDate>Sat, 29 Mar 2008 19:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/2008/03/27/sustainable-development-in-ruby-part-1-good-old-fashioned-inheritance/#comment-114</guid>
		<description>I think this is a perfect example of where to prefer composition over inheritance.  I would probably do:&lt;br&gt;&lt;br&gt;&lt;code&gt;class BufferedReader&lt;br&gt;  def initialize(connection)&lt;br&gt;    @connection = connection&lt;br&gt;  end&lt;br&gt;  &lt;br&gt;  def receive&lt;br&gt;    buffer = &quot;&quot;&lt;br&gt;    begin&lt;br&gt;      message = @connection.receive&lt;br&gt;      buffer &lt;&lt; message.data&lt;br&gt;    end until(message.data.include?(&quot;ENDENDEND&quot;))&lt;br&gt;    Message.new(buffer)&lt;br&gt;  end&lt;br&gt;end&lt;/code&gt;&lt;br&gt;&lt;br&gt;This allows you to combine different readers to achieve the behavior you want.  Not only that, but now the buffered reader is generally useful instead of being coupled to the Connection class.</description>
		<content:encoded><![CDATA[<p>I think this is a perfect example of where to prefer composition over inheritance.  I would probably do:</p>
<p><code>class BufferedReader&lt;br&gt;  def initialize(connection)&lt;br&gt;    @connection = connection&lt;br&gt;  end&lt;br&gt;  &lt;br&gt;  def receive&lt;br&gt;    buffer = &quot;&quot;&lt;br&gt;    begin&lt;br&gt;      message = @connection.receive&lt;br&gt;      buffer &amp;lt;&amp;lt; message.data&lt;br&gt;    end until(message.data.include?(&quot;ENDENDEND&quot;))&lt;br&gt;    Message.new(buffer)&lt;br&gt;  end&lt;br&gt;end</code></p>
<p>This allows you to combine different readers to achieve the behavior you want.  Not only that, but now the buffered reader is generally useful instead of being coupled to the Connection class.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.386 seconds -->
