<?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>Thu, 02 Sep 2010 04:05:01 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ayumilove</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-3447</link>
		<dc:creator>ayumilove</dc:creator>
		<pubDate>Mon, 03 May 2010 22:46:21 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-3447</guid>
		<description>for instance:
function createProduct (type : String) : Product
{
switch(type)
{
case PRODUCT_A : return new ProductA();
case PRODUCT_B : return new ProductB();
}
return new NullProduct();
}</description>
		<content:encoded><![CDATA[<p>for instance:<br />
function createProduct (type : String) : Product<br />
{<br />
switch(type)<br />
{<br />
case PRODUCT_A : return new ProductA();<br />
case PRODUCT_B : return new ProductB();<br />
}<br />
return new NullProduct();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ayumilove</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-3446</link>
		<dc:creator>ayumilove</dc:creator>
		<pubDate>Mon, 03 May 2010 22:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-3446</guid>
		<description>my factory has a switch case (if-else statement), how would i use polymorphism to solve this?</description>
		<content:encoded><![CDATA[<p>my factory has a switch case (if-else statement), how would i use polymorphism to solve this?</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-3445</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Mon, 03 May 2010 16:31:14 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-3445</guid>
		<description>@ayumilove, I don&#039;t think we ever recorded that one. :-(</description>
		<content:encoded><![CDATA[<p>@ayumilove, I don&#8217;t think we ever recorded that one. <img src='http://misko.hevery.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ayumilove</title>
		<link>http://misko.hevery.com/2008/12/08/clean-code-talks-inheritance-polymorphism-testing/comment-page-1/#comment-3435</link>
		<dc:creator>ayumilove</dc:creator>
		<pubDate>Sun, 02 May 2010 07:06:58 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=347#comment-3435</guid>
		<description>In the video, the presenter mention something about not overusing polymorphism that causes runaway subclassing (as in too many classes)

Where can I find that google clean code talk video focussing on that particular subject?</description>
		<content:encoded><![CDATA[<p>In the video, the presenter mention something about not overusing polymorphism that causes runaway subclassing (as in too many classes)</p>
<p>Where can I find that google clean code talk video focussing on that particular subject?</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>
