<?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: Clean Code Talks &#8211; Inheritance, Polymorphism, &amp; Testing</title>
	<atom:link href="http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Sat, 13 Mar 2010 19:20:13 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Se hace camino al andar&#8230; &#187; Blog Archive &#187; Muerte al if</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-3143</link>
		<dc:creator>Se hace camino al andar&#8230; &#187; Blog Archive &#187; Muerte al if</dc:creator>
		<pubDate>Mon, 01 Mar 2010 23:46:16 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-3143</guid>
		<description>[...] blog. Os recomiendo encarecidamente la siguiente entrada del blog de Miško Hevery titulada &#8220;Inheritance, Polymorphism, &amp; Testing&#8221; (sí, lo siento, en inglés) porque no tiene desperdicio. Tranquilos, si no os queréis [...]</description>
		<content:encoded><![CDATA[<p>[...] blog. Os recomiendo encarecidamente la siguiente entrada del blog de Miško Hevery titulada &#8220;Inheritance, Polymorphism, &amp; Testing&#8221; (sí, lo siento, en inglés) porque no tiene desperdicio. Tranquilos, si no os queréis [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-2272</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Thu, 05 Nov 2009 15:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-2272</guid>
		<description>@Sarah,

Glad to be of service.</description>
		<content:encoded><![CDATA[<p>@Sarah,</p>
<p>Glad to be of service.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah Xia</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-2269</link>
		<dc:creator>Sarah Xia</dc:creator>
		<pubDate>Thu, 05 Nov 2009 11:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-2269</guid>
		<description>Hi Misko, 

Thanks for the great talk! 

I watched it on Youtube last night and couldn&#039;t agree with you more. I went to work this morning and looked at a project I implemented. Boy, so many if statements, so I tried to use polymorphism, and then it was so much easier to understand.  My code is so much clearer! I was in a really happy mood for the whole day..even now! 

I feel like my skill somewhere moved up to another level. Thank you!</description>
		<content:encoded><![CDATA[<p>Hi Misko, </p>
<p>Thanks for the great talk! </p>
<p>I watched it on Youtube last night and couldn&#8217;t agree with you more. I went to work this morning and looked at a project I implemented. Boy, so many if statements, so I tried to use polymorphism, and then it was so much easier to understand.  My code is so much clearer! I was in a really happy mood for the whole day..even now! </p>
<p>I feel like my skill somewhere moved up to another level. Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mrclay.org &#187; Archive &#187; Miško Hevery Programming Talks</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-1285</link>
		<dc:creator>mrclay.org &#187; Archive &#187; Miško Hevery Programming Talks</dc:creator>
		<pubDate>Mon, 29 Jun 2009 18:35:27 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-1285</guid>
		<description>[...] Inheritance, Polymorphism, &amp; Testing [...]</description>
		<content:encoded><![CDATA[<p>[...] Inheritance, Polymorphism, &amp; Testing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-597</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Tue, 20 Jan 2009 03:50:42 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-597</guid>
		<description>@Scott, in most cases the conditional ends up in the factory, but sometimes the factory is created polymorphically,  so the if ends up even higher up.</description>
		<content:encoded><![CDATA[<p>@Scott, in most cases the conditional ends up in the factory, but sometimes the factory is created polymorphically,  so the if ends up even higher up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-596</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 20 Jan 2009 02:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-596</guid>
		<description>Hi Misko;



I&#039;ve been watching the Clean Code Talks on YouTube and learning lots. Thanks for the effort.



Sorry to comment late for this posting, but I&#039;m still trying to
understand something about replacing conditionals with polymorphism.



I understand how you can extract each &quot;leg&quot; of a conditional into its
own class, then instantiate the behavior that you want from a factory
class.



What I don&#039;t understand is how do the factories know which classes to
instantiate? It seems like the ideal place for a conditional. 



In Ruby we have a few meta helpers like this:

class PeelerFactory&#160;&#160; thin_skinned_fruits = [&quot;apple&quot;, &quot;pear&quot;]&#160;&#160; my_fruits = []&#160;&#160;&#160;&#160;
thin_skinned_fruits.each do &#124;f&#124;
&#160;&#160;&#160;&#160; my_fruits &lt;&lt; Object.const_get(&quot;#{f.capitalize}Peeler&quot;).new&#160;&#160;
endendclass ApplePeeler; endclass PearPeeler; end

Is this what you have in mind? Or is it OK
to use conditionals in factory classes?class PeelerFactory&#160;&#160;


def initialize(type)&#160; @type = type&#160; end&#160; def peeler&#160;&#160;&#160; case @type&#160;&#160;&#160; when &quot;apple&quot;&#160;&#160;&#160;&#160;&#160;&#160; ApplePeeler.new&#160;&#160;&#160; when &quot;pear&quot;&#160;&#160;&#160;&#160;&#160;&#160; PearPeeler.new&#160;&#160;&#160; end&#160; end
end
class ApplePeeler; end
class PearPeeler; end

Thanks!Scott</description>
		<content:encoded><![CDATA[<p>Hi Misko;</p>
<p>I&#8217;ve been watching the Clean Code Talks on YouTube and learning lots. Thanks for the effort.</p>
<p>Sorry to comment late for this posting, but I&#8217;m still trying to<br />
understand something about replacing conditionals with polymorphism.</p>
<p>I understand how you can extract each &#8220;leg&#8221; of a conditional into its<br />
own class, then instantiate the behavior that you want from a factory<br />
class.</p>
<p>What I don&#8217;t understand is how do the factories know which classes to<br />
instantiate? It seems like the ideal place for a conditional. </p>
<p>In Ruby we have a few meta helpers like this:</p>
<p>class PeelerFactory&nbsp;&nbsp; thin_skinned_fruits = ["apple", "pear"]&nbsp;&nbsp; my_fruits = []&nbsp;&nbsp;&nbsp;&nbsp;<br />
thin_skinned_fruits.each do |f|<br />
&nbsp;&nbsp;&nbsp;&nbsp; my_fruits &lt;&lt; Object.const_get(&#8221;#{f.capitalize}Peeler&#8221;).new&nbsp;&nbsp;<br />
endendclass ApplePeeler; endclass PearPeeler; end</p>
<p>Is this what you have in mind? Or is it OK<br />
to use conditionals in factory classes?class PeelerFactory&nbsp;&nbsp;</p>
<p>def initialize(type)&nbsp; @type = type&nbsp; end&nbsp; def peeler&nbsp;&nbsp;&nbsp; case @type&nbsp;&nbsp;&nbsp; when &#8220;apple&#8221;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ApplePeeler.new&nbsp;&nbsp;&nbsp; when &#8220;pear&#8221;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PearPeeler.new&nbsp;&nbsp;&nbsp; end&nbsp; end<br />
end<br />
class ApplePeeler; end<br />
class PearPeeler; end</p>
<p>Thanks!Scott</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-510</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Tue, 30 Dec 2008 13:22:14 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-510</guid>
		<description>@suraj

In order to get rid of &#039;if/case&#039; you need to replace it with polymorphism. Create a class &#039;Role&#039; and than subclass it into &#039;Admin&#039;, &#039;Manager&#039;, etc... When you call disable on the &#039;Role&#039; class depending on whether the role is Admin or a Manager different code will execute.</description>
		<content:encoded><![CDATA[<p>@suraj</p>
<p>In order to get rid of &#8216;if/case&#8217; you need to replace it with polymorphism. Create a class &#8216;Role&#8217; and than subclass it into &#8216;Admin&#8217;, &#8216;Manager&#8217;, etc&#8230; When you call disable on the &#8216;Role&#8217; class depending on whether the role is Admin or a Manager different code will execute.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suraj</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-509</link>
		<dc:creator>suraj</dc:creator>
		<pubDate>Tue, 30 Dec 2008 08:13:36 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-509</guid>
		<description>Can any one help me out ?I am working on Role base application where there are 12 role like Admin,manager,Reporter,...... and i have used role in menu for enable and disable.Here&#160; how can i remove multiple if ..else case.Regards,Suraj</description>
		<content:encoded><![CDATA[<p>Can any one help me out ?I am working on Role base application where there are 12 role like Admin,manager,Reporter,&#8230;&#8230; and i have used role in menu for enable and disable.Here&nbsp; how can i remove multiple if ..else case.Regards,Suraj</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kai</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-462</link>
		<dc:creator>Kai</dc:creator>
		<pubDate>Thu, 11 Dec 2008 01:49:18 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-462</guid>
		<description>I like your style of presentation. And this was again one I learned alot. But I am lost with the example in the presentation: could you show how to implement the toString method (with parentheses only when needed)? I could not figure it out by myself.

Regards, Kai</description>
		<content:encoded><![CDATA[<p>I like your style of presentation. And this was again one I learned alot. But I am lost with the example in the presentation: could you show how to implement the toString method (with parentheses only when needed)? I could not figure it out by myself.</p>
<p>Regards, Kai</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nazgob</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-451</link>
		<dc:creator>nazgob</dc:creator>
		<pubDate>Mon, 08 Dec 2008 22:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-451</guid>
		<description>Very good presentation. I like this series, hope it&#039;s gonna be long :) It&#039; s like a sum up of Refactoring + GoF DP + Working Effectivly With Legacy Code with na nice examples. I use (or try) these stuff all the time in my work (legacy C/C++) when I refactor to fix sth or just to &quot;Reduce the cost of change&quot;. Long live DIP :)

Regards,
nazgob</description>
		<content:encoded><![CDATA[<p>Very good presentation. I like this series, hope it&#8217;s gonna be long <img src='http://misko.hevery.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217; s like a sum up of Refactoring + GoF DP + Working Effectivly With Legacy Code with na nice examples. I use (or try) these stuff all the time in my work (legacy C/C++) when I refactor to fix sth or just to &#8220;Reduce the cost of change&#8221;. Long live DIP <img src='http://misko.hevery.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Regards,<br />
nazgob</p>
]]></content:encoded>
	</item>
</channel>
</rss>
