<?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: When To Code To an Interface</title>
	<atom:link href="http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/</link>
	<description>Homepage of Steve Novoselac</description>
	<lastBuildDate>Fri, 12 Mar 2010 15:59:49 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: naturalight67</title>
		<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/comment-page-1/#comment-125051</link>
		<dc:creator>naturalight67</dc:creator>
		<pubDate>Tue, 25 Nov 2008 14:20:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevienova.com/?p=940#comment-125051</guid>
		<description>Actually, semantically what a person &quot;is&quot; could be vague enough for some businesses, like healthcare, to warrant to use of interfaces.</description>
		<content:encoded><![CDATA[<p>Actually, semantically what a person &#8220;is&#8221; could be vague enough for some businesses, like healthcare, to warrant to use of interfaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yarin Benado</title>
		<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/comment-page-1/#comment-118535</link>
		<dc:creator>Yarin Benado</dc:creator>
		<pubDate>Sat, 30 Aug 2008 20:49:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevienova.com/?p=940#comment-118535</guid>
		<description>You are partly correct saying that there are times when a concrete class will suffice and you&#039;ll never need a different implementation of it, But your example is wrong. a Person is a an entity abstraction, where the importance of it being its properties rather than interacting methods. There&#039;s really no need to interface your model domain, as changing it will not require changing other layers of the system.

The paradigm of coding to interfaces rather than to classes is more relevant to a service layer or persistency and not to models.

When you&#039;re coding services, you&#039;re almost always predefining a &quot;contract&quot; which other components shall respect and interact upon. With this in mind, it&#039;s actually a must to code to interfaces in order to gain the benefits of loosely coupled components (and of course &quot;extras&quot; such as IoC, strategy and other patterns, etc.)

It&#039;s actually pretty easy to see which components should be &quot;interfaced&quot; and which should not by drawing a UML component diagram (where interfaces components actually take a large part)</description>
		<content:encoded><![CDATA[<p>You are partly correct saying that there are times when a concrete class will suffice and you&#8217;ll never need a different implementation of it, But your example is wrong. a Person is a an entity abstraction, where the importance of it being its properties rather than interacting methods. There&#8217;s really no need to interface your model domain, as changing it will not require changing other layers of the system.</p>
<p>The paradigm of coding to interfaces rather than to classes is more relevant to a service layer or persistency and not to models.</p>
<p>When you&#8217;re coding services, you&#8217;re almost always predefining a &#8220;contract&#8221; which other components shall respect and interact upon. With this in mind, it&#8217;s actually a must to code to interfaces in order to gain the benefits of loosely coupled components (and of course &#8220;extras&#8221; such as IoC, strategy and other patterns, etc.)</p>
<p>It&#8217;s actually pretty easy to see which components should be &#8220;interfaced&#8221; and which should not by drawing a UML component diagram (where interfaces components actually take a large part)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Ballman</title>
		<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/comment-page-1/#comment-118434</link>
		<dc:creator>Aaron Ballman</dc:creator>
		<pubDate>Fri, 29 Aug 2008 06:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevienova.com/?p=940#comment-118434</guid>
		<description>Too much of a good thing is bad.  ;-)  But I do agree that many concepts which could be abstracted eventually end up being so, and interfaces are the way to go.  My general rule of thumb is: if I need to use it polymorphically, it&#039;s usually done via an interface.  If I can see a case where I&#039;ll want to use it polymorphically in the future, I&#039;ll use an interface.  Otherwise, just use a straight-up class.  Honestly, the refactoring to turn something into an interface when following this rule is so trivial that it really doesn&#039;t hurt.</description>
		<content:encoded><![CDATA[<p>Too much of a good thing is bad.  ;-)  But I do agree that many concepts which could be abstracted eventually end up being so, and interfaces are the way to go.  My general rule of thumb is: if I need to use it polymorphically, it&#8217;s usually done via an interface.  If I can see a case where I&#8217;ll want to use it polymorphically in the future, I&#8217;ll use an interface.  Otherwise, just use a straight-up class.  Honestly, the refactoring to turn something into an interface when following this rule is so trivial that it really doesn&#8217;t hurt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Novoselac</title>
		<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/comment-page-1/#comment-118432</link>
		<dc:creator>Steve Novoselac</dc:creator>
		<pubDate>Fri, 29 Aug 2008 04:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevienova.com/?p=940#comment-118432</guid>
		<description>right but how often to you need to mock your person class?</description>
		<content:encoded><![CDATA[<p>right but how often to you need to mock your person class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish</title>
		<link>http://blog.stevienova.com/2008/08/28/when-to-code-to-an-interface/comment-page-1/#comment-118430</link>
		<dc:creator>Harish</dc:creator>
		<pubDate>Fri, 29 Aug 2008 04:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevienova.com/?p=940#comment-118430</guid>
		<description>In my opinion coding against interfaces helps to enforce a key OOP&#039;s principle  &#039;coding against abstractions rather than implementation&#039; . This gives us the freedom to swap components at run time, also from a testability perspective , many frameworks like NMock ,RhinoMock ,etc which use DI to mock your calls require you to code against interfaces rather than implementations.</description>
		<content:encoded><![CDATA[<p>In my opinion coding against interfaces helps to enforce a key OOP&#8217;s principle  &#8216;coding against abstractions rather than implementation&#8217; . This gives us the freedom to swap components at run time, also from a testability perspective , many frameworks like NMock ,RhinoMock ,etc which use DI to mock your calls require you to code against interfaces rather than implementations.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
