<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrey Shchekin &#187; Design Guidelines</title>
	<atom:link href="http://blog.ashmind.com/category/design-guidelines/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ashmind.com</link>
	<description></description>
	<lastBuildDate>Mon, 15 Mar 2010 18:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Sins of .NET API Developers</title>
		<link>http://blog.ashmind.com/2008/03/25/sins-of-net-api-developers/</link>
		<comments>http://blog.ashmind.com/2008/03/25/sins-of-net-api-developers/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 09:14:36 +0000</pubDate>
		<dc:creator>Andrey Shchekin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Criticism]]></category>
		<category><![CDATA[Design Guidelines]]></category>

		<guid isPermaLink="false">http://blog.ashmind.com/index.php/2008/03/25/sins-of-net-api-developers/</guid>
		<description><![CDATA[There are several annoying design flaws I often stumble into in .NET APIs. I haven&#8217;t seen Design Guidelines on this matter, so I think I&#8217;ll point to 3 of these myself. The Generic Sin Do provide a non-generic overloads to generic utility methods. Ayende already wrote about it, so it does not make sense to [...]]]></description>
			<content:encoded><![CDATA[<p>There are several annoying design flaws I often stumble into in .NET APIs.   <br /> I haven&#8217;t seen Design Guidelines on this matter, so I think I&#8217;ll point to 3 of these myself.</p>
<ol>
<li>
<h4>The Generic Sin</h4>
<p><strong>Do</strong> provide a non-generic overloads to generic utility methods.        <br /> Ayende already <a href="http://www.ayende.com/Blog/archive/2008/02/23/Ayendes-Design-Guidelines-Rule-1.aspx">wrote about it</a>, so it does not make sense to repeat the reasons.        <br /> Fortunately, this is a very rare issue.</p>
<p>Violating framework: Castle.MicroKernel (DefaultKernel.ResolveServices&lt;T&gt;).</p>
</li>
<li>
<h4>The Sin of Shallow Digging</h4>
<p><strong>Do</strong> support non-public members when performing type/member discovery.        <br /> <strong>Do not</strong> ever use Assembly.GetExportedTypes unless this logic can easily be overriden.</p>
<p>For example, I like to make my Domain Service interfaces public, but keep implementations internal.       <br /> This means that if I use InternalsVisibleTo, I can unit-test implementations, but the clients must use interfaces.        <br /> But if I try to define a common generic test base class, and use it like XTest : TestBase&lt;X&gt;, then if X is internal XTest should also be.        <br /> Now neither MbUnit or TestDriven.Net see my test, regardless of TestFixture attribute.</p>
<p>So if you use attributes to discover members automatically, the only reason to discard a member should be the absense of an attribute.       <br /> Access modifiers should not be considered, if the member does have an attribute.</p>
<p>Violating frameworks: MbUnit, Castle.Facilities.BatchRegistration.</p>
</li>
<li>
<h4>The Sin of Tivoization</h4>
<p>For each public interface you create, <strong>think</strong> how user can inject his own implementation.        <br /> (If this interface is directly consumed by API public methods, you can skip this step).</p>
<p>For example, let&#8217;s look at an interface MbUnit.Core.IFixtureFactory.       <br /> It is public, which seems good enough for people who hate internals.        <br /> But it is not possible to provide your implementation without wrapping the whole test-running engine.</p>
<p>It&#8217;s a pity. The framework I am developing right now would really benefit from it.</p>
<p>Violating frameworks: MbUnit.</p>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.ashmind.com/2008/03/25/sins-of-net-api-developers/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

