<?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>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
	<atom:link href="http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=refactoring-the-refactored-switch-statement</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2012 09:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/comment-page-1/#comment-44971</link>
		<dc:creator>Boise Code Camp &#38; Tech Fest Day 1 &#124; Elegant Code</dc:creator>
		<pubDate>Sat, 28 Mar 2009 19:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/#comment-44971</guid>
		<description>[...] about Live Mesh that’s being given by fellow Elegant Coder Sean Timm who is the author of what is perhaps my favorite EC post (the paragraph entitled “Sean Timm’s rules of proper switch statement etiquette” is classic). [...]</description>
		<content:encoded><![CDATA[<p>[...] about Live Mesh that’s being given by fellow Elegant Coder Sean Timm who is the author of what is perhaps my favorite EC post (the paragraph entitled “Sean Timm’s rules of proper switch statement etiquette” is classic). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/comment-page-1/#comment-43970</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew # 277</dc:creator>
		<pubDate>Mon, 02 Feb 2009 08:11:02 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/#comment-43970</guid>
		<description>[...] Refactoring the Refactored Switch Statement - Sean Timm, as guest blogger over at Elegant Code, talks about refactoring switch statements, looking at the need for this, along with some techniques for achieving this refactoring using polymorphism. [...]</description>
		<content:encoded><![CDATA[<p>[...] Refactoring the Refactored Switch Statement &#8211; Sean Timm, as guest blogger over at Elegant Code, talks about refactoring switch statements, looking at the need for this, along with some techniques for achieving this refactoring using polymorphism. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/comment-page-1/#comment-43957</link>
		<dc:creator>Dew Drop - January 31, 2009 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Sat, 31 Jan 2009 21:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/#comment-43957</guid>
		<description>[...] Refactoring the Refactored Switch Statement (Sean Timm) [...]</description>
		<content:encoded><![CDATA[<p>[...] Refactoring the Refactored Switch Statement (Sean Timm) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/comment-page-1/#comment-43956</link>
		<dc:creator>Sean Timm</dc:creator>
		<pubDate>Sat, 31 Jan 2009 17:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/#comment-43956</guid>
		<description>It&#039;s good to bring out the apologist in you, Chris.  :)  I completely agree with your desire to eliminate the switch statements, and it&#039;s rare that I run across one that wouldn&#039;t be better off in a different form.

My main concern called out in this article is that the majority of switch statements I&#039;ve run into in production code involve multiple switches with multiple responsibilities and invariably would be better off in polymorphic form.

In these cases, your dictionary refactor is an effective addition to the steps called out in this article (in the case where creation of the appropriate subclass needs handled by a switch), but the main problem in the code isn&#039;t the existence of a switch but the use of it.</description>
		<content:encoded><![CDATA[<p>It&#8217;s good to bring out the apologist in you, Chris.  <img src='http://elegantcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I completely agree with your desire to eliminate the switch statements, and it&#8217;s rare that I run across one that wouldn&#8217;t be better off in a different form.</p>
<p>My main concern called out in this article is that the majority of switch statements I&#8217;ve run into in production code involve multiple switches with multiple responsibilities and invariably would be better off in polymorphic form.</p>
<p>In these cases, your dictionary refactor is an effective addition to the steps called out in this article (in the case where creation of the appropriate subclass needs handled by a switch), but the main problem in the code isn&#8217;t the existence of a switch but the use of it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>BUY Minipress XL (Brand) ONLINE WITHOUT PRESCRIPTION</title>
		<link>http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/comment-page-1/#comment-43954</link>
		<dc:creator>Chris Brandsma</dc:creator>
		<pubDate>Sat, 31 Jan 2009 16:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://elegantcode.com/2009/01/31/refactoring-the-refactored-switch-statement/#comment-43954</guid>
		<description>I&#039;m feeling a slight need to defend myself here.  :)

The main point of &quot;Refactorring a switch statement was that a switch statement can be replaced with a Dictionary.  Even if the switch is done correctly (with polymorphism), like you did here, can still contain a rather nasty switch statement in the guts.  

For example: If you are writing a tag processor (you are taking in a file with custom, distinct, tags in that that indicated a need to perform an action), the list of possible tags can get quite large.  One commenter on my post was talking about having 1500 case statements in a single switch because of this.

Everything was kept simple in that post to highlight one point: a Dictionary is an effective alternative.  Even all the suggestions that people put on the blog ignored one fact: they had done everything but remove the switch.  I wanted it GONE.  

You moved the switch to another class, which had merely migrated an ugly piece of code to a new home -- which is what you are supposed to do with code that is becoming unmanageable, but I wanted to make it less ugly from the start.  No polymorphic trick will remove a switch statement (but it will make it easier to remove).

Part of this could just be me.  I don&#039;t hate the switch statement, I use them from time to time, but I think they should be used much more rarely than they are.

But, effective refactoring is a multi-step process.  Thank you for showing one of the other steps.</description>
		<content:encoded><![CDATA[<p>I&#8217;m feeling a slight need to defend myself here.  <img src='http://elegantcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The main point of &#8220;Refactorring a switch statement was that a switch statement can be replaced with a Dictionary.  Even if the switch is done correctly (with polymorphism), like you did here, can still contain a rather nasty switch statement in the guts.  </p>
<p>For example: If you are writing a tag processor (you are taking in a file with custom, distinct, tags in that that indicated a need to perform an action), the list of possible tags can get quite large.  One commenter on my post was talking about having 1500 case statements in a single switch because of this.</p>
<p>Everything was kept simple in that post to highlight one point: a Dictionary is an effective alternative.  Even all the suggestions that people put on the blog ignored one fact: they had done everything but remove the switch.  I wanted it GONE.  </p>
<p>You moved the switch to another class, which had merely migrated an ugly piece of code to a new home &#8212; which is what you are supposed to do with code that is becoming unmanageable, but I wanted to make it less ugly from the start.  No polymorphic trick will remove a switch statement (but it will make it easier to remove).</p>
<p>Part of this could just be me.  I don&#8217;t hate the switch statement, I use them from time to time, but I think they should be used much more rarely than they are.</p>
<p>But, effective refactoring is a multi-step process.  Thank you for showing one of the other steps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

