<?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: Polymorphism and the switch statement</title>
	<atom:link href="http://www.udidahan.com/2006/08/04/polymorphism-and-the-switch-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com/2006/08/04/polymorphism-and-the-switch-statement/</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: Udi Dahan - The Software Simplist</title>
		<link>http://www.udidahan.com/2006/08/04/polymorphism-and-the-switch-statement/comment-page-1/#comment-350</link>
		<dc:creator>Udi Dahan - The Software Simplist</dc:creator>
		<pubDate>Fri, 04 Aug 2006 12:32:27 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/306#comment-350</guid>
		<description>John,

The reason it can&#039;t/shouldn&#039;t be instantiated with an object implementing IEntity is that it receives the type of entity to be created (as per the &#039;new&#039; command). What this means is that these handlers are created at system startup as &quot;singletons&quot; and will be handling the given commands for those entity types.

The generic class means I don&#039;t have to create an implementation for every entity type in the system.
</description>
		<content:encoded><![CDATA[<p>John,</p>
<p>The reason it can&#8217;t/shouldn&#8217;t be instantiated with an object implementing IEntity is that it receives the type of entity to be created (as per the &#8216;new&#8217; command). What this means is that these handlers are created at system startup as &#8220;singletons&#8221; and will be handling the given commands for those entity types.</p>
<p>The generic class means I don&#8217;t have to create an implementation for every entity type in the system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Wood</title>
		<link>http://www.udidahan.com/2006/08/04/polymorphism-and-the-switch-statement/comment-page-1/#comment-349</link>
		<dc:creator>John Wood</dc:creator>
		<pubDate>Fri, 04 Aug 2006 02:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://wp_630.weblogs.us/archives/306#comment-349</guid>
		<description>Firstly that does look a better implementation, it&#039;s obvious that your solution was well suited to polymorphism, even though not all switch statements are. Secondly perhaps I&#039;m missing something but your polymorphic implementation looks more complex than it needs to be. Why not have one command handler class that is instantiated with an IEntity, I don&#039;t see what you gain from it being a generic class. And why do you need the if statement to check the type? Surely you can run builder.Build with an IEntityView taking any IEntity type.</description>
		<content:encoded><![CDATA[<p>Firstly that does look a better implementation, it&#8217;s obvious that your solution was well suited to polymorphism, even though not all switch statements are. Secondly perhaps I&#8217;m missing something but your polymorphic implementation looks more complex than it needs to be. Why not have one command handler class that is instantiated with an IEntity, I don&#8217;t see what you gain from it being a generic class. And why do you need the if statement to check the type? Surely you can run builder.Build with an IEntityView taking any IEntity type.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
