<?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: Refactoring a Switch statement</title>
	<atom:link href="http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/</link>
	<description></description>
	<lastBuildDate>Sat, 13 Mar 2010 20:52:38 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Christian Shiel</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-44174</link>
		<dc:creator>Christian Shiel</dc:creator>
		<pubDate>Mon, 23 Feb 2009 20:30:25 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-44174</guid>
		<description>Hey thanks for this, I really like it I actually have some questions...

Should we EVER use a switch statement?

The only time I consider using them is when I know the code is final and that code is sitting on the very top layer almost like a script.

In my last job I was &quot;set straight&quot; that case statements were in fact the only way to do certain things which at the time I strongly disagreed with. For instance type checking &amp; do such and such if its this type etc. I took it quite hard that my efforts to aim for elegance were put down and dismissed and I had to have those ideas knocked out of me! I&#039;m still very bitter by the whole experience.

I wonder what stands in the way of these ideals, and why we have things such as case statements?</description>
		<content:encoded><![CDATA[<p>Hey thanks for this, I really like it I actually have some questions&#8230;</p>
<p>Should we EVER use a switch statement?</p>
<p>The only time I consider using them is when I know the code is final and that code is sitting on the very top layer almost like a script.</p>
<p>In my last job I was &#8220;set straight&#8221; that case statements were in fact the only way to do certain things which at the time I strongly disagreed with. For instance type checking &amp; do such and such if its this type etc. I took it quite hard that my efforts to aim for elegance were put down and dismissed and I had to have those ideas knocked out of me! I&#8217;m still very bitter by the whole experience.</p>
<p>I wonder what stands in the way of these ideals, and why we have things such as case statements?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Jack</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-44020</link>
		<dc:creator>Colin Jack</dc:creator>
		<pubDate>Sun, 08 Feb 2009 17:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-44020</guid>
		<description>I&#039;ve used this pattern too, sometimes I&#039;ll have a domain factory class that produces little strategy objects based on some criteria. Hate using IoC in such a situation and this solution works a treat.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used this pattern too, sometimes I&#8217;ll have a domain factory class that produces little strategy objects based on some criteria. Hate using IoC in such a situation and this solution works a treat.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Refactoring the Refactored Switch Statement &#124; Elegant Code</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-43947</link>
		<dc:creator>Refactoring the Refactored Switch Statement &#124; Elegant Code</dc:creator>
		<pubDate>Sat, 31 Jan 2009 09:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-43947</guid>
		<description>[...] In her book, Relevance and Linguistic Meaning: The Semantics and Pragmatics of Discourse Markers, Diane Blakemore speaks, among other things, of incoherent interpretation and contextual assumptions.&#160; While pondering these phrases, I was reminded of Chris Brandsma’s recent article on Refactoring a switch statement. [...]</description>
		<content:encoded><![CDATA[<p>[...] In her book, Relevance and Linguistic Meaning: The Semantics and Pragmatics of Discourse Markers, Diane Blakemore speaks, among other things, of incoherent interpretation and contextual assumptions.&#160; While pondering these phrases, I was reminded of Chris Brandsma’s recent article on Refactoring a switch statement. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bharath</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-43849</link>
		<dc:creator>Bharath</dc:creator>
		<pubDate>Mon, 26 Jan 2009 23:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-43849</guid>
		<description>Problem is we have aroung 1500 switch cases in our controller is there anything we can do to refator</description>
		<content:encoded><![CDATA[<p>Problem is we have aroung 1500 switch cases in our controller is there anything we can do to refator</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sorensen</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-43419</link>
		<dc:creator>Bill Sorensen</dc:creator>
		<pubDate>Tue, 20 Jan 2009 18:18:43 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-43419</guid>
		<description>Here&#039;s an alternative:
http://www.netobjectives.com/PatternRepository/index.php?title=TheStrategyTemplatePattern</description>
		<content:encoded><![CDATA[<p>Here&#8217;s an alternative:<br />
<a href="http://www.netobjectives.com/PatternRepository/index.php?title=TheStrategyTemplatePattern" rel="nofollow">http://www.netobjectives.com/PatternRepository/index.php?title=TheStrategyTemplatePattern</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: W.D.</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-42974</link>
		<dc:creator>W.D.</dc:creator>
		<pubDate>Fri, 16 Jan 2009 17:46:46 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-42974</guid>
		<description>I agree with JP, refactoring to patterns would point you to polymorphism.</description>
		<content:encoded><![CDATA[<p>I agree with JP, refactoring to patterns would point you to polymorphism.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Bailey</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-42774</link>
		<dc:creator>Bill Bailey</dc:creator>
		<pubDate>Mon, 12 Jan 2009 22:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-42774</guid>
		<description>I just created a switch statement with 5,000 items (I tried more but Visual Studio kept crashing). This coworker must have been an idiot with a lot of time on his hands.</description>
		<content:encoded><![CDATA[<p>I just created a switch statement with 5,000 items (I tried more but Visual Studio kept crashing). This coworker must have been an idiot with a lot of time on his hands.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rainer Schuster</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-2/#comment-42761</link>
		<dc:creator>Rainer Schuster</dc:creator>
		<pubDate>Mon, 12 Jan 2009 17:31:25 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-42761</guid>
		<description>I&#039;ve allready done this approach in a small project. Have you meassured the performance ?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve allready done this approach in a small project. Have you meassured the performance ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J.P. Hamilton</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-1/#comment-42760</link>
		<dc:creator>J.P. Hamilton</dc:creator>
		<pubDate>Mon, 12 Jan 2009 17:22:02 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-42760</guid>
		<description>I am going with Sergio on this one. A switch might be an indication of an OCP violation and I would look towards polymorphism to get rid of it entirely.</description>
		<content:encoded><![CDATA[<p>I am going with Sergio on this one. A switch might be an indication of an OCP violation and I would look towards polymorphism to get rid of it entirely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cristian</title>
		<link>http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/comment-page-1/#comment-42753</link>
		<dc:creator>cristian</dc:creator>
		<pubDate>Mon, 12 Jan 2009 14:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/10/refactoring-a-switch-statement/#comment-42753</guid>
		<description>Refactor a switch statement into a dictionary remembers me my early days learning python, I asked one day &quot;what? python doesn&#039;t have a switch statement?&quot; and the python users answer me with the &quot;dictionary use&quot;.
There still a few things to learn from languages as python ;)</description>
		<content:encoded><![CDATA[<p>Refactor a switch statement into a dictionary remembers me my early days learning python, I asked one day &#8220;what? python doesn&#8217;t have a switch statement?&#8221; and the python users answer me with the &#8220;dictionary use&#8221;.<br />
There still a few things to learn from languages as python <img src='http://elegantcode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
