<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Brad Abrams  : Framework Design Guidelines</title><link>http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx</link><description>Tags: Framework Design Guidelines</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Video Posted for Belgium Visual Studio User’s Group: 10 Years of Framework Design Guidelines</title><link>http://blogs.msdn.com/brada/archive/2009/10/11/video-posted-for-belgium-visual-studio-user-s-group-10-years-of-framework-design-guidelines.aspx</link><pubDate>Mon, 12 Oct 2009 00:34:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9905961</guid><dc:creator>BradA</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/brada/comments/9905961.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9905961</wfw:commentRss><description>&lt;p&gt;As a nice follow up from my &lt;a href="http://blogs.msdn.com/brada/archive/2009/09/28/belgium-visual-studio-user-s-group-10-years-of-framework-design-guidelines.aspx"&gt;Belgium Visual Studio User’s Group: 10 Years of Framework Design Guidelines&lt;/a&gt; talk, I saw that they just &lt;a href="http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx?id=1443#"&gt;posted the video (slides+audio).&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx?id=1443#"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/VideoPostedforBelgiumVisualStudioUsersGr_F739/image_3.png" width="376" height="263" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Oh, and i must include the shameless plug…&amp;#160; &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition)&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/VideoPostedforBelgiumVisualStudioUsersGr_F739/image_6.png" width="189" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9905961" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Belgium Visual Studio User’s Group: 10 Years of Framework Design Guidelines</title><link>http://blogs.msdn.com/brada/archive/2009/09/28/belgium-visual-studio-user-s-group-10-years-of-framework-design-guidelines.aspx</link><pubDate>Mon, 28 Sep 2009 23:15:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9900435</guid><dc:creator>BradA</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/brada/comments/9900435.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9900435</wfw:commentRss><description>&lt;p&gt;I had a great time at the the Belgium &lt;a href="http://visug.be/Eventdetails/tabid/95/EventId/16/Default.aspx"&gt;Visual Studio User’s Group&lt;/a&gt; meeting.&amp;#160; The turn out was excellent.&amp;#160; Thanks especially to &lt;a href="http://www.snowball.be/"&gt;Gill Cleeren&lt;/a&gt;&amp;#160; and &lt;a href="http://kinnie.blogspot.com/"&gt;Pieter Gheysens&lt;/a&gt; for hosting it.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://visug.be/"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/BelgiumVisualStudioUsersGroup10YearsofFr_BA50/image_3.png" width="244" height="78" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Gill asked me to talk about &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines&lt;/a&gt; – I subject near and dear to my heart.&amp;#160;&amp;#160; I decided to do a bit of a look back over the last 10 years of framework design (we started&amp;#160; what would later become the CLR about 10 years ago)..&amp;#160;&amp;#160;&amp;#160; It is really fun to look at what has changed and what has not.&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/BelgiumVisualStudioUsersGroup10YearsofFr_BA50/image_6.png" width="169" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks to the great folks at Addison-Wesley i was able to give away a few copies of the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;book&lt;/a&gt; as well. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Afterwards, we got to talking about how this stuff is actually the easy part of framework design.&amp;#160; What is really hard is the social aspects.&amp;#160; How do you get management bought into spending time on building shared components?&amp;#160; how do you measure ROI in this space?&amp;#160;&amp;#160;&amp;#160; Do investments in well designed, common frameworks pay off?&amp;#160;&amp;#160; What do you think?&amp;#160; any positive or negative experiences?&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.slideshare.net/brada/framework-design-guidelines-for-brussels-users-group"&gt;Download the slide deck&lt;/a&gt;.&amp;#160; I am told there is a video as well… I will post a link when I get it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyway, here is the deck, enjoy.&amp;#160; As I told someone at the event, plagiarism is the highest form of flattery.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9900435" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines Book: Extra Content from the DVD Posted</title><link>http://blogs.msdn.com/brada/archive/2009/04/01/framework-design-guidelines-book-extra-content-from-the-dvd-posted.aspx</link><pubDate>Thu, 02 Apr 2009 08:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9506514</guid><dc:creator>BradA</dc:creator><slash:comments>20</slash:comments><comments>http://blogs.msdn.com/brada/comments/9506514.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9506514</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://www.amazon.com/Framework-Design-Guidelines/dp/B0017SWPNO/ref=kinw_dp_ke"&gt;&lt;img style="margin: 0px; display: inline" border="0" alt="Framework Design Guidelines" align="left" src="http://ecx.images-amazon.com/images/I/51NPBXl9ozL._SL500_AA242_PIkin-dp-500,BottomRight,-12,38_AA280_SH20_OU01_.jpg" width="168" height="168" /&gt;&lt;/a&gt;A few weeks ago a reader wrote in to tell me that they bought the &lt;a href="http://www.amazon.com/Framework-Design-Guidelines/dp/B0017SWPNO/ref=kinw_dp_ke"&gt;Kindle version&lt;/a&gt; of the &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FFramework-Design-Guidelines-Conventions-Development%2Fdp%2F0321545613%3Fpf%5Frd%5Fp%3D413864201%26pf%5Frd%5Fs%3Dcenter-41%26pf%5Frd%5Ft%3D201%26pf%5Frd%5Fi%3D0321246756%26pf%5Frd%5Fm%3DATVPDKIKX0DER%26pf%5Frd%5Fr%3D0XVZQQCQQ1W58EXATJ1P&amp;amp;tag=bradabramsblo-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;Framework Design Guidelines&lt;/a&gt; and was disappointed to not receive the DVD.&amp;#160; Well, I was of course immediately jealous because I don’t have a &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FKindle-Amazons-Wireless-Reading-Device%2Fdp%2FB000FI73MA&amp;amp;tag=bradabramsblo-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;kindle&lt;/a&gt;, but when I got over that, I ask the our excellent publishers and &lt;a href="http://www.pearsonhighered.com/catalog/series/1,3123,MzM1MTk3-TWljcm9zb2Z0IC5ORVQgRGV2ZWxvcG1lbnQgU2VyaWVz,00.html"&gt;Addison-Wesley&lt;/a&gt; what we could do for our Kindle readers.&amp;#160; To my (very pleasant) surprise, they suggested that we could just make all the DVD contents available for free on their website.&amp;#160; So now, everyone on the internet gets this small dividend from the kindle!&amp;#160; &lt;/p&gt;  &lt;p&gt;Enjoy…&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.informit.com/content/images/9780321545619/downloads/Cwalina_DVD.zip"&gt;Download&lt;/a&gt; the entire DVD in one zip file. NOTE: The file is 2.34 GB in size.&amp;#160; This includes a number of very helpful videos of presentations that cover much of the content of the book.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.informit.com/content/images/9780321545619/downloads/Cwalina_DVD_Shell.zip"&gt;Download&lt;/a&gt; everything but the Presentations, which includes:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Framework Layering tools&lt;/p&gt;    &lt;p&gt;TxRef tool for creating simple C# headerfile views of frameworks&lt;/p&gt;    &lt;p&gt;Sample API Specification &lt;/p&gt;    &lt;p&gt;Links to &lt;a href="http://code.msdn.microsoft.com/codeanalysis/"&gt;FxCop&lt;/a&gt; and &lt;a href="http://code.msdn.microsoft.com/fds"&gt;Framework Design Studio&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;BTW – if you have liked the book, or have some feedback that may help other readers,&amp;#160; I’d appreciate it if you &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FFramework-Design-Guidelines-Conventions-Development%2Fproduct-reviews%2F0321545613%3Fie%3DUTF8%26showViewpoints%3D1&amp;amp;tag=bradabramsblo-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;wrote a quick review for Amazon&lt;/a&gt;.&amp;#160; This helps customers more quickly find material they are interested in (or not).&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9506514" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: the System.* namespace</title><link>http://blogs.msdn.com/brada/archive/2009/03/26/framework-design-guidelines-the-system-namespace.aspx</link><pubDate>Fri, 27 Mar 2009 08:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9506416</guid><dc:creator>BradA</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/brada/comments/9506416.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9506416</wfw:commentRss><description>&lt;p&gt;Today we have a guest post from Kit George who is the keeper of much of our internal Framework Design Guidelines.&amp;#160; This is the stuff that Krys and I based a the book on.&amp;#160; I asked Kit to post this internal information so you can get a feeling for what our guidelines are and why…. and so you can call us on it if we mess it up ;-)&lt;/p&gt;  &lt;p&gt;As always, feedback and comments are welcome!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;It is clear that there’s a bit of confusion over the &lt;a href="http://blogs.msdn.com/brada/archive/2008/11/16/what-does-that-net-namespace-mean-system-and-microsoft.aspx"&gt;namespace guidelines&lt;/a&gt;. Here is our attempt at make this clear.&amp;#160; We know this will remain a contentious issue, but the goal of these guidelines is to clarify:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The .NET platform is not limited to any one single redistributable.&lt;/li&gt;    &lt;li&gt;Types in the System.* namespace define the .NET platform. We of course carry existing types with us that go against this rule, but moving forward, we will adopt this approach&lt;/li&gt;    &lt;li&gt;Something within Microsoft.* is produced by Microsoft but is not part of the .NET platform&lt;/li&gt;    &lt;li&gt;APIs that are not necessarily going to be shipped are differentiable from APIs that are intended to be shipped&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The .NET platform (which includes Silverlight, the full .NET Framework, the .NET Compact Framework, etc) continues to be that set of managed functionality, produced by Microsoft, that is for general application use. This doesn’t mean APIs that are guaranteed to be useful to every application (we can’t guarantee that), but APIs which can be used by many different application purposes and styles. These APIs may be shipped in different ways. There are other interesting questions that aren’t addressed by namespaces. &lt;/p&gt;  &lt;p&gt;How does a user determine if an API is in Silverlight, but not in the .NET Framework 3.5? How does a user determine if an API is officially supported? How does a user determine if an API is usable on a device? These issues will be resolved using other mechanisms, not namespaces.&lt;/p&gt;  &lt;p&gt;The following guidance comes out of this position and is used internally to help us follow the position.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Microsoft will use&lt;/u&gt;&lt;/b&gt; System.* for namespaces that are planned to be exposed publically and are considered part of the .NET platform.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Types that are part of the platform have expectations around quality, compatibility, consistency of design, and general usability. Types that are suitable for the platform portray the following characteristics:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;We expect the API to be used by a wide variety of applications&lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Examples: string, central collections (List&amp;lt;T&amp;gt;, etc.), Linq, data&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;ul&gt;     &lt;li&gt;The API may be specific to a high level, but part of a general purpose application model (Label, TextBox, etc.) &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Examples: Web, Windows.Forms, WPF&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;The API is formed of common abstractions and primitives that allow higher-level components to communicate&lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Examples: System.IO, System.Globalization&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;The API has had considerable design invested and is well-factored, reviewed, and consistent with the system. Depending on the ship vehicle, the size and deployment impact will have been considered       &lt;br /&gt;&lt;/li&gt;      &lt;li&gt;The API is finished and therefore, doesn’t require significant changes once publically available&lt;/li&gt;   &lt;/ul&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Microsoft will use&lt;/u&gt;&lt;/b&gt; use Microsoft.* for namespaces that are planned to be shipped by the team and are considered application or non-platform components.&lt;/p&gt;  &lt;p&gt;This applies to APIs/namespaces that are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Part of an application. Applications are by definition, not useful to a variety of other scenarios/applications.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Example: Visual Studio, Office, SharePoint&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Non-Core. Non-Core can be interpreted as ‘not for general Application use’. If you can’t see the API being used in most scenarios, or many application styles, it’s likely non-core. This includes APIs that serve a subset platform (for example, a common platform layer inside Office), APIs that are for a constrained task (such as MSBuild), or for a particular application type. This is NOT to say these cannot be moved/generalized in future versions if appropriate&lt;/li&gt; &lt;/ul&gt;  &lt;blockquote&gt;   &lt;p&gt;Example: MSBuild, Office Infrastructure APIs&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Microsoft will use&lt;/u&gt;&lt;/b&gt; Microsoft.Experimental.* for namespaces that are seeking consumer input, but have no committed ship plan&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;At Microsoft, In order to ship a CTP of a feature, a team and divisional commitment to officially productize the API is in place. Nothing is final, but the conviction and intent is there. Prior to this stage, there is literally no commitment or plans to ship the API. Use Microsoft.Experimental.* to communicate to customers that the feature in question is long-lead and may not see the light of day. Once the team is committed to shipping the API and is working on a schedule, feel free to use the most appropriate namespace based on the purpose of the productized type.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;Avoid&lt;/u&gt;&lt;/b&gt; changing the namespace of a type once you’ve decided to ship the type publically (once you’ve reached the Beta stage).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Changing the namespace from a Beta onwards is costly to consumers. This issue is absolutely secondary to getting the namespace right, but consider the impact when making such decisions.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9506416" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: LINQ Support</title><link>http://blogs.msdn.com/brada/archive/2009/03/09/framework-design-guidelines-linq-support.aspx</link><pubDate>Tue, 10 Mar 2009 04:12:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133188</guid><dc:creator>BradA</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133188.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133188</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_2.png"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the LINQ section of Chapter 9: Common Design Patterns.&lt;/p&gt;  &lt;p&gt;Supporting LINQ through IEnumerable&amp;lt;T&amp;gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO&lt;/strong&gt; implement IEnumerable&amp;lt;T&amp;gt; to enable basic LINQ support. &lt;/p&gt;  &lt;p&gt;Such basic support should be sufficient for most in-memory data sets. The basic LINQ support will use the extension methods on IEnumerable&amp;lt;T&amp;gt; provided in the .NET Framework. For example, simply defineing as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class RangeOfInt32s : IEnumerable&amp;lt;int&amp;gt; {     &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;public IEnumerator&amp;lt;int&amp;gt; GetEnumerator() {&amp;#8230;}     &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;IEnumerator IEnumerable.GetEnumerator() {&amp;#8230;}     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Doing so Allows for the following code, despite the fact that RangeOfInt32s did not implement a Where method:.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;var a = new RangeOfInt32s();     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;var b = a.Where(x =&amp;gt; x&amp;gt;10);&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ricom/"&gt;RICO MARIANI&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Keeping in mind that you&amp;#8217;ll get your same enumeration semantics, and putting a Linq fa&amp;#231;ade on them does not make them execute any faster or use less memory.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133188" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Dependency Properties</title><link>http://blogs.msdn.com/brada/archive/2009/03/02/framework-design-guidelines-dependency-properties.aspx</link><pubDate>Tue, 03 Mar 2009 05:10:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133184</guid><dc:creator>BradA</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133184.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133184</wfw:commentRss><description>&lt;p&gt;Continuing in our &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_2.png"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Dependency Properties section of Chapter 9: Common Design Patterns. Phil offers some great additions to the base pattern.&lt;/p&gt;  &lt;p&gt;The following guidelines describe details of Dependency Property dependency property design.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO&lt;/strong&gt; inherit from DependencyObject, or one of its subtypes, when implementing Dependency Properties. The type provides a very efficient implementation of a property store and automatically supports WPF data binding. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO&lt;/strong&gt; provide a regular CLR property and public static read-only field storing an instance of System.Windows.DependencyProperty for each Dependency Propertydependency property.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class TextButton : DependencyObject {     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public string Text {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;get { return (string)this.GetValue(TextProperty); }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;set { this.SetValue(TextProperty,value); }     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public static readonly DependencyProperty TextProperty =     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;DependencyProperty.Register(&amp;quot;Text&amp;quot;,typeof(string),     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; typeof(TextButton));      &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; }     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO &lt;/strong&gt;implement Dependency Propertiesdependency properties by calling instance methods DependencyObject.GetValue and DependencyObject.SetValue.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class TextButton : DependencyObject {     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public string Text {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;get { return (string)this.GetValue(TextProperty); }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;set { this.SetValue(TextProperty,value); }     &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;}     &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;public static readonly DependencyProperty TextProperty = &amp;#8230;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO &lt;/strong&gt;name the Dependency Propertydependency property static field by suffixing the name of the property with &amp;#8220;Property.&amp;#8221;. &lt;/p&gt;  &lt;p&gt;The first parameter to the DependencyProperty.Register method should be the name of the wrapper property.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class TextButton : DependencyObject {     &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;public static readonly DependencyProperty TextProperty =     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;DependencyProperty.Register(&amp;quot;Text&amp;quot;,typeof(string),     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; typeof(TextButton));      &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133184" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Factored Types</title><link>http://blogs.msdn.com/brada/archive/2009/02/23/framework-design-guidelines-factored-types.aspx</link><pubDate>Tue, 24 Feb 2009 05:03:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133169</guid><dc:creator>BradA</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133169.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133169</wfw:commentRss><description>&lt;p&gt;Continuing in our &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_2.png"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Factored Types section of Chapter 9: Common Design Patterns. Phil offers some great additions to the base pattern.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://haacked.com/"&gt;PHIL HAACK&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Since Factored Types have an explicit lifetime, it probably makes good sense to implement the IDisposable interface so that developers can make use of the using statement. The code sample here could then be refactored to:&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;using(SerialPort port = new SerialPort(&amp;quot;COM1&amp;quot;)) {       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;port.Open();       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;GZipStream compressed;       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;compressed = new GZipStream(port.BaseStream,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CompressionMode.Compress);        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;compressed.Write(data, 0, data.Length);       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133169" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: System.DBNull</title><link>http://blogs.msdn.com/brada/archive/2009/02/09/framework-design-guidelines-system-dbnull.aspx</link><pubDate>Tue, 10 Feb 2009 04:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133153</guid><dc:creator>BradA</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133153.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133153</wfw:commentRss><description>&lt;p&gt;Continuing in our &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_2.png"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Nullable&amp;lt;T&amp;gt; section of Chapter 8: Usage Guidelines. Pablo helps us out with some subtle details that might really come in handy. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;AVOID&lt;/strong&gt; using System.DBNull. Prefer Nullable&amp;lt;T&amp;gt; instead.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/pablo/"&gt;PABLO CASTRO&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Nullable&amp;lt;T&amp;gt; is in general a better representation of optional database values. One thing to consider though is that while Nullable&amp;lt;T&amp;gt; gives you the ability to represent null values, you don&amp;#8217;t get database null operational semantics. Specifically, you don&amp;#8217;t get null propagation through operators and functions. If you deeply care about the propagation semantics, consider sticking with DBNull.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133153" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Overriding Object.ToString()</title><link>http://blogs.msdn.com/brada/archive/2009/02/02/framework-design-guidelines-overriding-object-tostring.aspx</link><pubDate>Tue, 03 Feb 2009 04:54:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133149</guid><dc:creator>BradA</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133149.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133149</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Object.ToString section of Chapter 8: Usage Guidelines. Christophe provides some great implementation tips for these guidelines.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO&lt;/strong&gt; try to keep the string returned from ToString short.&lt;/p&gt;  &lt;p&gt;The debugger uses ToString to get a textual representation of an object to be shown to the developer. If the string is longer than the debugger can display (typically less than one screen length), the debugging experience is hindered. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://cnasarre.spaces.live.com/"&gt;CHRISTOPHE NASARRE&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;In term of debugging experience, you should decorate your type with DebuggerDisplayAttribute in addition to overriding ToString for that particular purpose.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;DO &lt;/strong&gt;string formatting based on the current thread culture when returning culture-dependent information.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://cnasarre.spaces.live.com/"&gt;CHRISTOPHE NASARRE&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;To be more explicit, use the CultureInfo instance returned by a thread&amp;#8217;s CurrentCulture property to format any numeric or date, and the one returned by CurrentUICulture to look up any resource. People are often confused between the two properties.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133149" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>.NET Fireside Chats - Brad Abrams and Krzysztof Cwalina</title><link>http://blogs.msdn.com/brada/archive/2009/01/27/net-fireside-chats-brad-abrams-and-krzysztof-cwalina.aspx</link><pubDate>Wed, 28 Jan 2009 06:52:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9379654</guid><dc:creator>BradA</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/brada/comments/9379654.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9379654</wfw:commentRss><description>&lt;p&gt;The .NET Zone just published an interview with Kry and me.&amp;nbsp; Check it out:&lt;/p&gt; &lt;p&gt;&lt;a href="http://dotnet.dzone.com/articles/net-fireside-chats-brad-abrams" target="_blank"&gt;.NET Fireside Chats - Brad Abrams and Krzysztof Cwalina&lt;/a&gt;&lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/d64.NETFiresideChatsBradAbramsandKrzyszt_11796/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/d64.NETFiresideChatsBradAbramsandKrzyszt_11796/image_thumb.png" width="265" height="50"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;You can learn some interesting stuff about what lead to writing the first edition of the book, what a 'Framework' is and what the hardest framework design problems are.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I'd love to hear your feedback and thoughts&lt;/p&gt; &lt;p&gt;Oh, and they published a sample section of the book for free in PDF format.&amp;nbsp; This is from &lt;a href="http://dotnet.dzone.com/sites/all/files/FrameworkDesign2e0321545613.pdf" target="_blank"&gt;Chapter 9 and covers LINQ guidelines&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9379654" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Avoiding custom delegates</title><link>http://blogs.msdn.com/brada/archive/2009/01/26/framework-design-guidelines-avoiding-custom-delegates.aspx</link><pubDate>Tue, 27 Jan 2009 04:49:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9133139</guid><dc:creator>BradA</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/brada/comments/9133139.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9133139</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2nd edition&lt;/a&gt;.. This content is found&lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;&lt;img height="240" alt="image[5]_thumb[2]_thumb[2]_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesScenarioDrivenF_10568/image%5B5%5D_thumb%5B2%5D_thumb%5B2%5D_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt; in the Events and Callbacks section of Chapter 6: Designing for Extensibility. I am impressed by how simple new additions to the BCL can have such a large (and positive) effect on framework design. As these new advances come out, learn them and use them!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DO &lt;/strong&gt;use the new Func&amp;lt;&amp;#8230;&amp;gt;, Action&amp;lt;&amp;#8230;&amp;gt;, or Expression&amp;lt;&amp;#8230;&amp;gt; instead of custom delegates, when defining APIs with callbacks. &lt;/p&gt;  &lt;p&gt;Func&amp;lt;&amp;#8230;&amp;gt; and Action&amp;lt;&amp;#8230;&amp;gt; represent generic delegates. The following is how .NET Framework defines them:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New" size="2"&gt;public delegate void Action()       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate void Action&amp;lt;T1, T2&amp;gt;(T1 arg1, T2 arg2)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate void Action&amp;lt;T1, T2, T3&amp;gt;(T1 arg1, T2 arg2, T3 arg3)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate void Action&amp;lt;T1, T2, T3, T4&amp;gt;(T1 arg1, T2 arg2, T3 arg3, T4 arg4)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate TResult Func&amp;lt;TResult&amp;gt;()       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate TResult Func&amp;lt;T, TResult&amp;gt;(T arg)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate TResult Func&amp;lt;T1, T2, TResult&amp;gt;(T1 arg1, T2 arg2)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate TResult Func&amp;lt;T1, T2, T3, TResult&amp;gt;(T1 arg1, T2 arg2, T3 arg3)       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;public delegate TResult Func&amp;lt;T1, T2, T3, T4, TResult&amp;gt;(T1 arg1, T2 arg2, T3 arg3, T4 arg4)&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;They can be used as follows:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;Func&amp;lt;int,int,double&amp;gt; divide = (x,y)=&amp;gt;(double)x/(double)y;       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Action&amp;lt;double&amp;gt; write = (d)=&amp;gt;Console.WriteLine(d);       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;write(divide(2,3));&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Expression&amp;lt;&amp;#8230;&amp;gt; represents function definitions that can be compiled and subsequently invoked at runtime but can also be serialized and passed to remote processes. Continuing with our example:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;Expression&amp;lt;Func&amp;lt;int,int,double&amp;gt;&amp;gt; expression =(x,y)=&amp;gt;(double)x/(double)y;       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Func&amp;lt;int,int,double&amp;gt; divide = expression.Compile();       &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;write(divide2(2,3));&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Notice how the syntax for constructing an Expression&amp;lt;&amp;gt; object is very similar to the one used to construct a Func&amp;lt;&amp;gt; object; in fact, the only difference is the static type declaration of the variable (Expression&amp;lt;&amp;gt; instead of Func&amp;lt;&amp;gt;).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ricom/"&gt;RICO MARIANI&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Most times you&amp;#8217;re going to want Func or Action if all that needs to happen is to run some code. You need Expression when the code needs to be analyzed, serialized, or optimized before it is run. Expression is for thinking about code, Func/Action is for running it.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9133139" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Sealed Classes</title><link>http://blogs.msdn.com/brada/archive/2009/01/19/framework-design-guidelines-sealed-classes.aspx</link><pubDate>Tue, 20 Jan 2009 06:10:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9046348</guid><dc:creator>BradA</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/brada/comments/9046348.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9046348</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesSealedClasses_10DB8/image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb_thumb_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesSealedClasses_10DB8/image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Extensibility Mechanisms section of Chapter 6: Designing for Extensibility. It is interesting to watch as new development methodologies become more popular and how the color the guidelines&amp;#8230; &lt;/p&gt;  &lt;p&gt;CONSIDER using unsealed classes with no added virtual or protected members as a great way to provide inexpensive yet much appreciated extensibility to a framework. &lt;/p&gt;  &lt;p&gt;Developers often want to inherit from unsealed classes so as to add convenience members such as custom constructors, new methods, or method overloads. For example, System.Messaging.MessageQueue is unsealed and thus allows users to create custom queues that default to a particular queue path or to add custom methods that simplify the API for specific scenarios (in the following example, the scenario is for a method sending Order objects to the queue).&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class OrdersQueue : MessageQueue {     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public OrdersQueue() : base(OrdersQueue.Path){     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;this.Formatter = new BinaryMessageFormatter();     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public void SendOrder(Order order){     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;Send(order,order.Id);     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; }      &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://haacked.com/"&gt;PHIL HAACK&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Because Test Driven Development has caught fire in the .NET Developer community, many developers want to inherit from unsealed classes (often dynamically using a mock framework) in order to substitute a test double in the place of the real implementation.&lt;/p&gt;    &lt;p&gt;At the very least, if you&amp;#8217;ve gone to the trouble of making your class unsealed, consider making key members virtual, perhaps via the Template Method Pattern, in order to provide more control.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9046348" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Extension Methods</title><link>http://blogs.msdn.com/brada/archive/2009/01/12/framework-design-guidelines-extension-methods.aspx</link><pubDate>Tue, 13 Jan 2009 06:07:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9046336</guid><dc:creator>BradA</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/brada/comments/9046336.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9046336</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesExtensionMethod_10D1D/image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesExtensionMethod_10D1D/image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Extension Methods section of Chapter 5: Member Design. One of the major new features we added to the Framework recently is extension methods. While this a very powerful new feature, it does come with some new responsibility.&lt;/p&gt;  &lt;p&gt;CONSIDER using extension methods in any of the following scenarios:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;To provide helper functionality relevant to every implementation of an interface, if said functionality can be written in terms of the core interface. This is because concrete implementations cannot otherwise be assigned to interfaces. For example, the LINQ to Objects operators are implemented as extension methods for all IEnumerable&amp;lt;T&amp;gt; types. Thus, any IEnumerable&amp;lt;&amp;gt; implementation is automatically LINQ-enabled. &lt;/li&gt;    &lt;li&gt;When an instance method would introduce a dependency on some type, but such a dependency would break dependency management rules. For example, a dependency from String to System.Uri is probably not desirable, and so String.ToUri() instance method returning System.Uri would be the wrong design from a dependency management perspective. A static extension method Uri.ToUri(this string str) returning System.Uri would be a much better design. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ricom/"&gt;RICO MARIANI&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The value of this cannot be overstated. Extension methods provide you with a way to give interfaces not just one default implementation but as many as you need, and you can choose between them simply by bringing the right namespace(s) into your lexical scope with using. However, this could be easily abused in the same way that complex #include combinations in C++ can make the final code hard to read.&lt;/p&gt;    &lt;p&gt;Another interesting feature of this manner of adding functionality to a class is that you could potentially partition (extension) methods of the same class into different assemblies for performance reasons. Again, this should not be done lightly, because you could cause great confusion.&lt;/p&gt;    &lt;p&gt;This is one of the many times I like to quote from Spiderman &amp;#8211; &amp;#8220;With great power comes great responsibility.&amp;#8221;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://haacked.com/"&gt;PHIL HAACK&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Section 2.2.4.1 covers the topic of layering in namespaces, which I think applies well to extension methods. &lt;/p&gt;    &lt;p&gt;One scenario I&amp;#8217;ve seen is to put functionality that is more advanced or esoteric in a separate namespace. That way, for core scenarios, these extra methods do not &amp;#8220;pollute&amp;#8221; the API. But for those who know about the namespace, or need these alternate scenarios, they can add the namespace and gain access to these extra methods.&lt;/p&gt;    &lt;p&gt;The drawback, of course, is that this results in a &amp;#8220;hidden&amp;#8221; API that is not very discoverable.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://www.bluebytesoftware.com/blog/"&gt;JOE DUFFY&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Extension methods can also be used to provide actual concrete method implementations for interfaces. For example, if you ship an IFoo interface, you can also have a static Foo class with a method public static void Bar(this IFoo f) that makes all instances of IFoo effectively have an extra Bar method.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9046336" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: An appeal for consistency</title><link>http://blogs.msdn.com/brada/archive/2008/12/15/framework-design-guidelines-an-appeal-for-consistency.aspx</link><pubDate>Tue, 16 Dec 2008 06:03:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9046315</guid><dc:creator>BradA</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/brada/comments/9046315.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9046315</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesAnappealforcons_10C23/image5_thumb2_thumb2_thumb_thumb_thu_thumb_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image5_thumb2_thumb2_thumb_thumb_thu_thumb" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesAnappealforcons_10C23/image5_thumb2_thumb2_thumb_thumb_thu_thumb_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Names of Classes, Structs, and Interfaces section of Chapter 3: Naming Guidelines. Even in the .NET Framework we don&amp;#8217;t always apply the design guidelines consistently &amp;#8211; and, as Phil found out, we often pay the price for it. &lt;/p&gt;  &lt;p&gt;DO ensure that the names differ only by the &amp;#8220;I&amp;#8221; prefix on the interface name when you are defining a class&amp;#8211;interface pair where the class is a standard implementation of the interface.&lt;/p&gt;  &lt;p&gt;The following example illustrates this guideline for the interface IComponent and its standard implementation, the class Component:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public interface IComponent { &amp;#8230; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class Component : IComponent { &amp;#8230; }&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://haacked.com/"&gt;PHIL HAACK&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One place where the framework violates this convention is the class HttpSessionState, which you would suspect implements IHttpSessionState, but you&amp;#8217;d be wrong, as I was. &lt;/p&gt;  &lt;p&gt;This inconsistency nearly bit us when we were developing our HttpContextBase abstraction of HttpContext, because it seemed we could expose the Session property as the IHttpSessionState interface, which turned out to not be the case. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9046315" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item><item><title>Framework Design Guidelines: Naming New Versions of Existing APIs</title><link>http://blogs.msdn.com/brada/archive/2008/12/08/framework-design-guidelines-naming-new-versions-of-existing-apis.aspx</link><pubDate>Tue, 09 Dec 2008 05:57:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9046283</guid><dc:creator>BradA</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/brada/comments/9046283.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brada/commentrss.aspx?PostID=9046283</wfw:commentRss><description>&lt;p&gt;Continuing in &lt;a href="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx"&gt;our weekly blog post series&lt;/a&gt; that highlights a few of the new &lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesNamingNewVersio_10AD0/image5_thumb2_thumb2_thumb_thumb_thu_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image5_thumb2_thumb2_thumb_thumb_thu" src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/FrameworkDesignGuidelinesNamingNewVersio_10AD0/image5_thumb2_thumb2_thumb_thumb_thu_thumb.png" width="168" align="right" border="0" /&gt;&lt;/a&gt;additions to the &lt;a href="http://www.amazon.com/gp/product/0321545613?ie=UTF8&amp;amp;tag=bradabramsblo-20&amp;amp;link_code=wql&amp;amp;camp=212361&amp;amp;creative=380601"&gt;Framework Design Guidelines 2&lt;sup&gt;nd&lt;/sup&gt; edition&lt;/a&gt;.. This content is found in the Naming New Versions of Existing APIs of Chapter 3: Naming Guidelines. Incrementally evolving an existing, popular API is very hard. My main take away personally from this guidelines (and Kit&amp;#8217;s annotation) is to work hard to get it right the first time!&lt;/p&gt;  &lt;p&gt;DO use the &amp;#8220;64&amp;#8221; suffix when introducing versions of APIs that operate on a 64-bit integer (a long integer) instead of a 32-bit integer. You only need to take this approach when the existing 32-bit API exists; don&amp;#8217;t do it for brand new APIs with only a 64-bit version.&lt;/p&gt;  &lt;p&gt;For example, various APIs on System.Diagnostics.Process return Int32 values representing memory sizes, such as PagedMemorySize or PeakWorkingSet. To appropriately support these APIs on 64-bit systems, APIs have been added that have the same name but a &amp;#8220;64&amp;#8221; suffix.&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;public class Process {     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; // old APIs     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public int PeakWorkingSet { get; }     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public int PagedMemorySize { get; }     &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; // &amp;#8230;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; // new APIs&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public long PeakWorkingSet64 { get; }     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; public long PagedMemorySize64 { get; }     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;KIT GEORGE&lt;/p&gt;  &lt;p&gt;Note that this guideline applies only to retrofitting APIs that have already shipped. When designing a brand new API, use the most appropriate type and name for the API that will work on all platforms, and avoid using both &amp;#8220;32&amp;#8221; and &amp;#8220;64&amp;#8221; suffixes. Consider using overloading.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9046283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brada/archive/tags/Framework+Design+Guidelines/default.aspx">Framework Design Guidelines</category></item></channel></rss>