<?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: Coding Tip #42: turning enums into classes</title>
	<atom:link href="http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/</link>
	<description></description>
	<lastBuildDate>Tue, 08 Jun 2010 10:50:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Sarah</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/comment-page-1/#comment-4470</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Mon, 03 Aug 2009 07:37:29 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=203#comment-4470</guid>
		<description>Yep - but it&#039;s still amazing how many times I need to call it out to people</description>
		<content:encoded><![CDATA[<p>Yep &#8211; but it&#8217;s still amazing how many times I need to call it out to people</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/comment-page-1/#comment-4331</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Tue, 28 Jul 2009 16:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=203#comment-4331</guid>
		<description>Is this not just a reworked polymorphic approach?</description>
		<content:encoded><![CDATA[<p>Is this not just a reworked polymorphic approach?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Round Up No.3 &#171; DevRoundUp.net</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/comment-page-1/#comment-3622</link>
		<dc:creator>Round Up No.3 &#171; DevRoundUp.net</dc:creator>
		<pubDate>Tue, 30 Jun 2009 21:47:18 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=203#comment-3622</guid>
		<description>[...] Coding Tip #42: turning enums into classes: Sarah Taraporewalla finds that her Enums keep turning into classes . [...]</description>
		<content:encoded><![CDATA[<p>[...] Coding Tip #42: turning enums into classes: Sarah Taraporewalla finds that her Enums keep turning into classes . [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Gillard-Moss</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/comment-page-1/#comment-3585</link>
		<dc:creator>Peter Gillard-Moss</dc:creator>
		<pubDate>Mon, 29 Jun 2009 16:26:05 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=203#comment-3585</guid>
		<description>I forgo enums and go straight to classes (except in Java where enums can have behaviour).  .NET enums are a waste of time and are syntatic sugar around ints etc. and prone to nastyness (e.g. (int)Vehicle.Car is legit no matter what the value).

Though word of warning: make sure that the class is immutable.  I&#039;ve seen people use this technique and introduce bugs because they start doing stuff like:
  mycar = Vehicle.Car
  car.Doors = 6</description>
		<content:encoded><![CDATA[<p>I forgo enums and go straight to classes (except in Java where enums can have behaviour).  .NET enums are a waste of time and are syntatic sugar around ints etc. and prone to nastyness (e.g. (int)Vehicle.Car is legit no matter what the value).</p>
<p>Though word of warning: make sure that the class is immutable.  I&#8217;ve seen people use this technique and introduce bugs because they start doing stuff like:<br />
  mycar = Vehicle.Car<br />
  car.Doors = 6</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ola Bini</title>
		<link>http://sarahtaraporewalla.com/thoughts/design/coding-tip-42-turning-enums-into-classes/comment-page-1/#comment-3575</link>
		<dc:creator>Ola Bini</dc:creator>
		<pubDate>Mon, 29 Jun 2009 09:02:31 +0000</pubDate>
		<guid isPermaLink="false">http://sarahtaraporewalla.com/thoughts/?p=203#comment-3575</guid>
		<description>It strikes me that in most cases where this pattern is relevant, it is exactly in the kind of cases you show above - and the reason you have to refactor in C# is because the enums aren&#039;t real objects.

In Java, this pattern doesn&#039;t exist, because Enum&#039;s are objects, and when you define them you can define different behavior for the different values and so on, or just different arguments to creation.

Have you seen any case where what you want to do goes outside of that?</description>
		<content:encoded><![CDATA[<p>It strikes me that in most cases where this pattern is relevant, it is exactly in the kind of cases you show above &#8211; and the reason you have to refactor in C# is because the enums aren&#8217;t real objects.</p>
<p>In Java, this pattern doesn&#8217;t exist, because Enum&#8217;s are objects, and when you define them you can define different behavior for the different values and so on, or just different arguments to creation.</p>
<p>Have you seen any case where what you want to do goes outside of that?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
