<?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: I Use Inheritance And I&#8217;m Not Entirely Ashamed Of It. Should I Be?</title>
	<atom:link href="http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/</link>
	<description>Better Than Yesterday</description>
	<lastBuildDate>Mon, 20 May 2013 17:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Charles Gardner</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1871</link>
		<dc:creator>Charles Gardner</dc:creator>
		<pubDate>Wed, 12 Oct 2011 06:54:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1871</guid>
		<description>How are you templating with the Inheritance?</description>
		<content:encoded><![CDATA[<p>How are you templating with the Inheritance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Gardner</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1870</link>
		<dc:creator>Charles Gardner</dc:creator>
		<pubDate>Wed, 12 Oct 2011 06:53:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1870</guid>
		<description>Woot Woot! Agreed!</description>
		<content:encoded><![CDATA[<p>Woot Woot! Agreed!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: StarTrekRedneck</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1368</link>
		<dc:creator>StarTrekRedneck</dc:creator>
		<pubDate>Tue, 25 Jan 2011 19:46:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1368</guid>
		<description>That was an interesting transition. In the original post, it felt like Mongoid was sort of praised for it&#039;s power and convenience. But in the last comment, Mongoid is criticized: &quot;I&#039;m stuck...because of Mongoid.&quot; I don&#039;t know if that&#039;s exactly what you mean or think, but I&#039;ve made transitions like that in my career, where one solution seemed the pinnacle of elegance and value, and later turned out to be inflexible and a liability. I guess we gotta keep learnin&#039;. Education ain&#039;t cheap, but the alternative is far more expensive.</description>
		<content:encoded><![CDATA[<p>That was an interesting transition. In the original post, it felt like Mongoid was sort of praised for it&#8217;s power and convenience. But in the last comment, Mongoid is criticized: &#8220;I&#8217;m stuck&#8230;because of Mongoid.&#8221; I don&#8217;t know if that&#8217;s exactly what you mean or think, but I&#8217;ve made transitions like that in my career, where one solution seemed the pinnacle of elegance and value, and later turned out to be inflexible and a liability. I guess we gotta keep learnin&#8217;. Education ain&#8217;t cheap, but the alternative is far more expensive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derick.bailey</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1367</link>
		<dc:creator>derick.bailey</dc:creator>
		<pubDate>Mon, 24 Jan 2011 14:35:24 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1367</guid>
		<description>i did a few experiments with my code and it looks like i&#039;m stuck with inheritance, because of Mongoid. i was not able to get it working from a module, unfortunately. so i&#039;m either stuck with inheritance or i have to duplicate the required fields in all of the objects that would use a module... and that&#039;s worse than inheritance, i think.

we&#039;ve also had some serious monkey wrenches thrown our way since i wrote this, and it looks like this code will have to sit for a while. this is probably a good thing, though. when we do come back to it, i&#039;ll have a better idea of how painful and/or poor the structure is - i&#039;ll have forgotten what i was thinking by then, and having to relearn it will expose a lot of problems i&#039;m sure. i just hope i can find good solutions when i finally do see the problems.</description>
		<content:encoded><![CDATA[<p>i did a few experiments with my code and it looks like i&#8217;m stuck with inheritance, because of Mongoid. i was not able to get it working from a module, unfortunately. so i&#8217;m either stuck with inheritance or i have to duplicate the required fields in all of the objects that would use a module&#8230; and that&#8217;s worse than inheritance, i think.</p>
<p>we&#8217;ve also had some serious monkey wrenches thrown our way since i wrote this, and it looks like this code will have to sit for a while. this is probably a good thing, though. when we do come back to it, i&#8217;ll have a better idea of how painful and/or poor the structure is &#8211; i&#8217;ll have forgotten what i was thinking by then, and having to relearn it will expose a lot of problems i&#8217;m sure. i just hope i can find good solutions when i finally do see the problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Teague</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1366</link>
		<dc:creator>John Teague</dc:creator>
		<pubDate>Mon, 24 Jan 2011 14:26:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1366</guid>
		<description>I don&#039;t think there&#039;s anything wrong with inheritance when used appropriately.  If you&#039;re inheritance structure is simple with only a few well contained branches then it&#039;s probably fine.  But as you mentioned in you&#039;re reply, if you get a lot of special cases, then the abstraction might be wrong.  At that point, strategy pattern, or in your case modules, sound appropriate.

</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think there&#8217;s anything wrong with inheritance when used appropriately.  If you&#8217;re inheritance structure is simple with only a few well contained branches then it&#8217;s probably fine.  But as you mentioned in you&#8217;re reply, if you get a lot of special cases, then the abstraction might be wrong.  At that point, strategy pattern, or in your case modules, sound appropriate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake Scott</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1365</link>
		<dc:creator>Jake Scott</dc:creator>
		<pubDate>Wed, 19 Jan 2011 15:40:51 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1365</guid>
		<description>Just came across this post http://openlandscape.wordpress.com/2010/05/11/taking-another-look-at-inheritance/</description>
		<content:encoded><![CDATA[<p>Just came across this post <a href="http://openlandscape.wordpress.com/2010/05/11/taking-another-look-at-inheritance/" rel="nofollow">http://openlandscape.wordpress.com/2010/05/11/taking-another-look-at-inheritance/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: derick.bailey</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1364</link>
		<dc:creator>derick.bailey</dc:creator>
		<pubDate>Wed, 19 Jan 2011 04:01:45 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1364</guid>
		<description>hank - i don&#039;t really don&#039;t agree with that. the cost of inheritance is still there in dynamic languages, and i started seeing this today. i ended up in a situation where my one of my inherited classes needed specialization so i had to inerhit from that subclass, which created grandchildren of the original class and sprawled the inheritance tree far beyond what i had ever hoped for. it&#039;s getting rather ugly, rather quickly.

scott - that&#039;s a lot for me to consider, and exactly the kind of insight i was looking for. looking back at the original decision on this inheritance chain, it&#039;s rather obvious that we chose it because we didn&#039;t know what else to do. it was easy to fall back into this because we had both done it in C# for many years. the dynamic nature of ruby combined with mongoid made it even easier, too. 

i&#039;m seeing a lot of concerns bleeding out in very strange places in my code right now. i&#039;m not sure if the inheritance is a cause or a symptom, or both at this point. i need to re-evaluate a lot of this code and throw together a few prototypes to see what it will take to move away from inheritance. 

more importantly, i think, i need to re-evaluate some of my abstractions and find out why so many of the concerns that my classes have feel like they&#039;re being tossed in as after-thoughts instead of modeled as real parts of the system. perhaps the inheritance is making it easy for me to make bad decisions on this front. it certain feels that way.</description>
		<content:encoded><![CDATA[<p>hank &#8211; i don&#8217;t really don&#8217;t agree with that. the cost of inheritance is still there in dynamic languages, and i started seeing this today. i ended up in a situation where my one of my inherited classes needed specialization so i had to inerhit from that subclass, which created grandchildren of the original class and sprawled the inheritance tree far beyond what i had ever hoped for. it&#8217;s getting rather ugly, rather quickly.</p>
<p>scott &#8211; that&#8217;s a lot for me to consider, and exactly the kind of insight i was looking for. looking back at the original decision on this inheritance chain, it&#8217;s rather obvious that we chose it because we didn&#8217;t know what else to do. it was easy to fall back into this because we had both done it in C# for many years. the dynamic nature of ruby combined with mongoid made it even easier, too. </p>
<p>i&#8217;m seeing a lot of concerns bleeding out in very strange places in my code right now. i&#8217;m not sure if the inheritance is a cause or a symptom, or both at this point. i need to re-evaluate a lot of this code and throw together a few prototypes to see what it will take to move away from inheritance. </p>
<p>more importantly, i think, i need to re-evaluate some of my abstractions and find out why so many of the concerns that my classes have feel like they&#8217;re being tossed in as after-thoughts instead of modeled as real parts of the system. perhaps the inheritance is making it easy for me to make bad decisions on this front. it certain feels that way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hank Fay</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1363</link>
		<dc:creator>Hank Fay</dc:creator>
		<pubDate>Wed, 19 Jan 2011 02:57:23 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1363</guid>
		<description>I think one difference worth noting is between statically-typed languages and dynamic languages.  Statically-typed system inheritance is problematic in terms of maintainability: what kind of object am I working with?  In dynamic systems, inheritance opens up focused reuse without incurring costs.  </description>
		<content:encoded><![CDATA[<p>I think one difference worth noting is between statically-typed languages and dynamic languages.  Statically-typed system inheritance is problematic in terms of maintainability: what kind of object am I working with?  In dynamic systems, inheritance opens up focused reuse without incurring costs.  </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Bellware</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1362</link>
		<dc:creator>Scott Bellware</dc:creator>
		<pubDate>Tue, 18 Jan 2011 21:50:24 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1362</guid>
		<description>Without getting into whether it&#039;s a defacto good or bad thing, there are still issues with this kind of inheritance that can make working code less &quot;workable&quot; - which is a productivity concern more than a whether-it-works concern.

The ultimate issue is that it&#039;s inheritance for the purpose of reuse rather than for hi-fidelity modeling of real world things.

Inheritance is the strongest kind of coupling.

There&#039;s a Single Responsibility Principle concern in all coupling. When a class has another class coupled to it, it serves that class as its master. When a class has two classes coupled to it, and if those classes are concerned with dissimilar things, the coupled class serves two masters. Now it has two reasons to change. Now rest squarely in the sights of SRP problems. Those problems may never arise, but potential is now locked and loaded.

DHH wrote an essay a few years ago about using modules rather than base classes in Rails if he could do it all over again, so we can&#039;t look at ActiveRecord as a justification. That &quot;justification&quot; has already been debunked. In the end, factoring ActiveRecord::Base into modules didn&#039;t happen in Rails3 because even though the problem potential was &quot;locked and loaded&quot; it wasn&#039;t really causing the kind of harm that justified the level of work needed for that change. Sometimes, coloring outside of the lines is a choice we make. Making the choice unconsciously is the ultimate problem.

You could have implemented the reuse in your model with modules, and in the end, it would have been a &quot;truer&quot; implementation, since the purpose of modules is more closely aligned with reusing something rather than extending identity to something. You might have chosen inheritance (sub classes) rather than composition (modules) because of class-oriented programming bias, who knows.

Regardless of what answer you find, it&#039;s the right question to ask of this design, and finding previously-unknown biases is like being released from shackles that you might not have known you were in. You can still choose to wear the shackles if you like the aesthetic, but you risk being tossed in jail by a cop who mistakes you for an escaped convict. Unforeseen design changes happen. Clean and proper use of patterns can help keep us free of unforeseen cost of change regardless of our aesthetic preferences.</description>
		<content:encoded><![CDATA[<p>Without getting into whether it&#8217;s a defacto good or bad thing, there are still issues with this kind of inheritance that can make working code less &#8220;workable&#8221; &#8211; which is a productivity concern more than a whether-it-works concern.</p>
<p>The ultimate issue is that it&#8217;s inheritance for the purpose of reuse rather than for hi-fidelity modeling of real world things.</p>
<p>Inheritance is the strongest kind of coupling.</p>
<p>There&#8217;s a Single Responsibility Principle concern in all coupling. When a class has another class coupled to it, it serves that class as its master. When a class has two classes coupled to it, and if those classes are concerned with dissimilar things, the coupled class serves two masters. Now it has two reasons to change. Now rest squarely in the sights of SRP problems. Those problems may never arise, but potential is now locked and loaded.</p>
<p>DHH wrote an essay a few years ago about using modules rather than base classes in Rails if he could do it all over again, so we can&#8217;t look at ActiveRecord as a justification. That &#8220;justification&#8221; has already been debunked. In the end, factoring ActiveRecord::Base into modules didn&#8217;t happen in Rails3 because even though the problem potential was &#8220;locked and loaded&#8221; it wasn&#8217;t really causing the kind of harm that justified the level of work needed for that change. Sometimes, coloring outside of the lines is a choice we make. Making the choice unconsciously is the ultimate problem.</p>
<p>You could have implemented the reuse in your model with modules, and in the end, it would have been a &#8220;truer&#8221; implementation, since the purpose of modules is more closely aligned with reusing something rather than extending identity to something. You might have chosen inheritance (sub classes) rather than composition (modules) because of class-oriented programming bias, who knows.</p>
<p>Regardless of what answer you find, it&#8217;s the right question to ask of this design, and finding previously-unknown biases is like being released from shackles that you might not have known you were in. You can still choose to wear the shackles if you like the aesthetic, but you risk being tossed in jail by a cop who mistakes you for an escaped convict. Unforeseen design changes happen. Clean and proper use of patterns can help keep us free of unforeseen cost of change regardless of our aesthetic preferences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Foltz</title>
		<link>http://lostechies.com/derickbailey/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be/#comment-1361</link>
		<dc:creator>Michael Foltz</dc:creator>
		<pubDate>Tue, 18 Jan 2011 21:45:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/derickbailey/archive/2011/01/18/i-use-inheritance-and-i-m-not-entirely-ashamed-of-it-should-i-be.aspx#comment-1361</guid>
		<description>I&#039;m no expert on the topic - although I&#039;ve been curious about what &quot;composition over inheritence&quot; (C/I) is all about as well.  After reading your post, I poked around to find useful examples of C/I

Here are two posts that I found useful:

http://www.thedotnetfrog.com/2008/05/30/choosing-composition-over-inheritance-yet-another-example/

http://www.ronaldwidha.net/2009/03/22/a-good-example-of-favouring-composition-over-inheritance/

Seems to me that the usefulness of C/I has more to do with behaviors than data.  For instance, with your &quot;question&quot; scenario, if you have to implement different validation techniques for different classes - and especially if some classes share one implementation while others use another, then it&#039;ll be easier in the long run to implement the validation logic outside of the classes and have them injected where needed (or for that matter to use a visitor pattern - which seems to be pretty damn&#039;d similar to the idea of composition).

As far as just specifying what fields are in various classes, I don&#039;t see how you can make it any more straight forward than to use inheritance.

I agree with Bob, Travis &amp; David.  If you can get around town on a moped, there&#039;s no point in driving an SUV.  Use the techniques that make the most sense, and ignore the code-guru dogma.   If the reason for using a particular technique isn&#039;t self-evident, then it&#039;s probably not the right technique.</description>
		<content:encoded><![CDATA[<p>I&#8217;m no expert on the topic &#8211; although I&#8217;ve been curious about what &#8220;composition over inheritence&#8221; (C/I) is all about as well.  After reading your post, I poked around to find useful examples of C/I</p>
<p>Here are two posts that I found useful:</p>
<p><a href="http://www.thedotnetfrog.com/2008/05/30/choosing-composition-over-inheritance-yet-another-example/" rel="nofollow">http://www.thedotnetfrog.com/2008/05/30/choosing-composition-over-inheritance-yet-another-example/</a></p>
<p><a href="http://www.ronaldwidha.net/2009/03/22/a-good-example-of-favouring-composition-over-inheritance/" rel="nofollow">http://www.ronaldwidha.net/2009/03/22/a-good-example-of-favouring-composition-over-inheritance/</a></p>
<p>Seems to me that the usefulness of C/I has more to do with behaviors than data.  For instance, with your &#8220;question&#8221; scenario, if you have to implement different validation techniques for different classes &#8211; and especially if some classes share one implementation while others use another, then it&#8217;ll be easier in the long run to implement the validation logic outside of the classes and have them injected where needed (or for that matter to use a visitor pattern &#8211; which seems to be pretty damn&#8217;d similar to the idea of composition).</p>
<p>As far as just specifying what fields are in various classes, I don&#8217;t see how you can make it any more straight forward than to use inheritance.</p>
<p>I agree with Bob, Travis &#038; David.  If you can get around town on a moped, there&#8217;s no point in driving an SUV.  Use the techniques that make the most sense, and ignore the code-guru dogma.   If the reason for using a particular technique isn&#8217;t self-evident, then it&#8217;s probably not the right technique.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
