<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://wperr.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fwperr.spaces.live.com%2fcategory%2f__x1Net%2bGuidelines%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Will's space: .Net Guidelines</title><description /><link>http://wperr.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=cat__x1Net%2bGuidelines</link><language>en-US</language><pubDate>Sat, 25 Oct 2008 14:16:15 GMT</pubDate><lastBuildDate>Sat, 25 Oct 2008 14:16:15 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://wperr.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-7536634898169727583</live:id><live:alias>wperr</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Simple Guidelines for Building Reusable .Net Libraries</title><link>http://wperr.spaces.live.com/Blog/cns!97687E7DACC7F5A1!155.entry</link><description>&lt;p&gt;There are some great (and very thorough) documents out there that can give you fantastic guidance on creating beautiful, reusable .Net libraries, &lt;a href="http://blogs.msdn.com/kcwalina/"&gt;Krzysztof Cwalina's Blog&lt;/a&gt; is my personal favourite. Most of it, however, is pretty verbose, very long and just feels a lot like overkill, so here are a few things I've done in the past that seem to work. &lt;ol&gt; &lt;li&gt;&lt;strong&gt;The 80/20 Split&lt;br&gt;&lt;/strong&gt;Consider the core functionality that 80% of the library users want to achieve, stick all the classes you need to achieve a solution in that 80% region in a concisely named namespace. Generally this means asking yourself: &lt;strong&gt;What do people want to do? &lt;/strong&gt;and &lt;strong&gt;What can I give them to help them do that?&lt;br&gt;&lt;/strong&gt;Next, consider that final 20%: Can your library be extended? If so how? What are the unusual, complex scenarios that require a deeper understanding of the technologies involved to build a solution? Once you figure this out, create a child namespace of your '80%' one and expose only the public types required to achieve that final 20%. &lt;li&gt;&lt;strong&gt;Visibility Modifiers are Your Friend&lt;/strong&gt;&lt;br&gt;(Generally) No one cares about your implementation details - if they do care its usually because your public interface sucks. In summary, if its not vitally important to getting the job done, hide it. Use internal for those important classes that ship data around your library but never see the outside world, mark static holder types as static, and remove the constructors for types that are constructed by a factory. Use 'internal' as the default modifier for type visibility and before changing it to public spend a few minutes thinking: &lt;ol&gt; &lt;li&gt;Does the name of the class really say what it does? (Nobody reads the manual) &lt;li&gt;Do the constructor arguments convey the minimum information needed to create a 'sane' instance? &lt;li&gt;Is this class useful to a user? what would they do with it? where would it come from and how is it consumed?&lt;/ol&gt; &lt;li&gt;&lt;strong&gt;Encapsulation is Your Best Friend&lt;/strong&gt;&lt;br&gt;The user of  your library didn't read the manual, they'll probably ignore the intellisense summaries too. Design your class so that everything you can do, you should do. &lt;ol&gt; &lt;li&gt;Public fields are evil (and inexcusable), use properties instead &lt;li&gt;(Generally) There is no need to expose a setter on a collection property, so don't do it &lt;li&gt;Wherever it makes sense, use immutability by marking fields as readonly&lt;/ol&gt;&lt;/ol&gt; &lt;p&gt;More later... &lt;p&gt;--W&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-7536634898169727583&amp;page=RSS%3a+Simple+Guidelines+for+Building+Reusable+.Net+Libraries&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=wperr.spaces.live.com&amp;amp;GT1=wperr"&gt;</description><comments>http://wperr.spaces.live.com/Blog/cns!97687E7DACC7F5A1!155.entry#comment</comments><guid isPermaLink="true">http://wperr.spaces.live.com/Blog/cns!97687E7DACC7F5A1!155.entry</guid><pubDate>Wed, 21 Nov 2007 12:51:28 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://wperr.spaces.live.com/blog/cns!97687E7DACC7F5A1!155/comments/feed.rss</wfw:commentRss><wfw:comment>http://wperr.spaces.live.com/Blog/cns!97687E7DACC7F5A1!155.entry#comment</wfw:comment><dcterms:modified>2007-11-21T12:51:28Z</dcterms:modified></item></channel></rss>