<?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: Switch statement angst</title>
	<atom:link href="http://www.udidahan.com/2006/08/01/switch-statement-angst/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Wed, 08 Sep 2010 18:14:32 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John Wood</title>
		<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/comment-page-1/#comment-348</link>
		<dc:creator>John Wood</dc:creator>
		<pubDate>Wed, 02 Aug 2006 21:39:16 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/305#comment-348</guid>
		<description>I agree with Udi here. The fact it doesn&#039;t support anything other than primitive constants and strings is inconsistent and confusing to developers, especially beginners. 

Also the argument that it&#039;s a code smell and that OO is supposed to get rid of switch statements isn&#039;t necessarily valid - if i replaced every switch statement or if construct with polymorphism my code would become signifantly larger and difficult to maintain. While switch statements do increase the cyclomatic complexity of the code, but when you introduce polymorphism the complexity becomes an unknown quantity. 
</description>
		<content:encoded><![CDATA[<p>I agree with Udi here. The fact it doesn&#8217;t support anything other than primitive constants and strings is inconsistent and confusing to developers, especially beginners. </p>
<p>Also the argument that it&#8217;s a code smell and that OO is supposed to get rid of switch statements isn&#8217;t necessarily valid &#8211; if i replaced every switch statement or if construct with polymorphism my code would become signifantly larger and difficult to maintain. While switch statements do increase the cyclomatic complexity of the code, but when you introduce polymorphism the complexity becomes an unknown quantity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Eyde</title>
		<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/comment-page-1/#comment-347</link>
		<dc:creator>Thomas Eyde</dc:creator>
		<pubDate>Wed, 02 Aug 2006 15:21:44 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/305#comment-347</guid>
		<description>&quot;OO languages were INVENTED to get away from switch statements&quot;

That may be, but all the time we have a switch statement, does it really have to be such a retarded, akward bastard?

Why is the start of the block marked with a colon? Why not use the curly bracket block any other construct use? 

And why isn&#039;t the break statement optional? Automatic fallthrough is prohibited, so it does nothing.</description>
		<content:encoded><![CDATA[<p>&#8220;OO languages were INVENTED to get away from switch statements&#8221;</p>
<p>That may be, but all the time we have a switch statement, does it really have to be such a retarded, akward bastard?</p>
<p>Why is the start of the block marked with a colon? Why not use the curly bracket block any other construct use? </p>
<p>And why isn&#8217;t the break statement optional? Automatic fallthrough is prohibited, so it does nothing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keith ray</title>
		<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/comment-page-1/#comment-346</link>
		<dc:creator>keith ray</dc:creator>
		<pubDate>Wed, 02 Aug 2006 09:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/305#comment-346</guid>
		<description>see &quot;replace conditional/switch with polymorphism&quot;

http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html

OO languages were INVENTED to get away from switch statements.

http://video.google.com/videoplay?docid=-2058469682761344178&amp;q=Dan+Ingalls</description>
		<content:encoded><![CDATA[<p>see &#8220;replace conditional/switch with polymorphism&#8221;</p>
<p><a href="http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html" rel="nofollow">http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html</a></p>
<p>OO languages were INVENTED to get away from switch statements.</p>
<p><a href="http://video.google.com/videoplay?docid=-2058469682761344178&amp;q=Dan+Ingalls" rel="nofollow">http://video.google.com/videoplay?docid=-2058469682761344178&amp;q=Dan+Ingalls</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc Brooks</title>
		<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/comment-page-1/#comment-345</link>
		<dc:creator>Marc Brooks</dc:creator>
		<pubDate>Wed, 02 Aug 2006 06:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/305#comment-345</guid>
		<description>No, please DON&#039;T fix it.  First, Type is not a constant. Second, this is a big code smell.

Rather, register the forms for each entity in a Dictionary static dictionary. Then the switch becomes:

IForm form = formFactory[e.EntityType];
form.Do();

You have to enumerate them somewhere to add them to the Dictionary, but if you do it this way, you can drive that enumeration from anything ranging from walking all loaded assemblies looking for the form to an XML/config file. This way everything just works.</description>
		<content:encoded><![CDATA[<p>No, please DON&#8217;T fix it.  First, Type is not a constant. Second, this is a big code smell.</p>
<p>Rather, register the forms for each entity in a Dictionary static dictionary. Then the switch becomes:</p>
<p>IForm form = formFactory[e.EntityType];<br />
form.Do();</p>
<p>You have to enumerate them somewhere to add them to the Dictionary, but if you do it this way, you can drive that enumeration from anything ranging from walking all loaded assemblies looking for the form to an XML/config file. This way everything just works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.udidahan.com/2006/08/01/switch-statement-angst/comment-page-1/#comment-344</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 02 Aug 2006 04:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/305#comment-344</guid>
		<description>Yes, it is different.  See http://blogs.msdn.com/peterhal/archive/2005/07/05/435760.aspx</description>
		<content:encoded><![CDATA[<p>Yes, it is different.  See <a href="http://blogs.msdn.com/peterhal/archive/2005/07/05/435760.aspx" rel="nofollow">http://blogs.msdn.com/peterhal/archive/2005/07/05/435760.aspx</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
