<?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>Krzysztof Cwalina : General Programming</title><link>http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx</link><description>Tags: General Programming</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>MEF on CodePlex</title><link>http://blogs.msdn.com/kcwalina/archive/2008/09/05/MEFCodePlex.aspx</link><pubDate>Sat, 06 Sep 2008 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8926943</guid><dc:creator>kcwalina</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/8926943.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=8926943</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=8926943</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;We have just released an update to MEF. You can get it at &lt;/FONT&gt;&lt;A href="http://www.codeplex.com/MEF" mce_href="http://www.codeplex.com/MEF"&gt;&lt;FONT face=Calibri size=3&gt;http://www.codeplex.com/MEF&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The changes are quite significant:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The preview ships with sources under a very permissive license (Ms-LPL).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;We now support constructor injection. Feature that the community asked for.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;We completely redesigned MEF’s extensibility points. The extensibility points are designed to support writing custom providers of composition data. For example, out of the box MEF requires composable parts to be attributed with attributes that provide metadata describing the composition. We got lots of feedback that this is not acceptable in many scenarios. The new extensibility points make it easier to extend MEF to externalize the metadata (to an XML file for example). Note, that the changes are just the first step toward the goal of making the extensibility easy and powerful. We will most probably keep making improvements in this space in the future, so feedback on the new extensibility points would be more then welcome.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;We significantly cleaned up the container APIs. But as above, there is more clean up to come in the future. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.25in"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8926943" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/MEF/default.aspx">MEF</category></item><item><title>Framework Design Studio Released</title><link>http://blogs.msdn.com/kcwalina/archive/2008/04/04/8357773.aspx</link><pubDate>Fri, 04 Apr 2008 21:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8357773</guid><dc:creator>kcwalina</dc:creator><slash:comments>21</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/8357773.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=8357773</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=8357773</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;When I was coming back from Mix 2007, I was bored on the plane and so started to write a dev tool. What a geeky thing to do on a plane. :-)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The tool allows comparing two versions of an assembly to identify API differences: API additions and removals. Comparing versions of APIs comes very handy during API design process. Often you want to ensure that things did not get removed accidentally (which can cause incompatibilities), and as APIs grow, you want to review the addition without having to re-review APIs that were already reviewed. The tool, called Framework Design Studio (FDS) supports these scenarios. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Later on, I got lots of help from Hongping Lim (a developer on our team), and David Fowler (our 2007 summer intern). David ported the application to WPF, and Hongping basically took it from an early prototype stage to what it is today and made it possible to ship it externally.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Anyway, you can get the tool at the MSDN &lt;/FONT&gt;&lt;A href="http://code.msdn.microsoft.com/fds"&gt;&lt;FONT face=Calibri size=3&gt;Code Gallery&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, the user guide is attached to this post, and lastly, here is the API diff output that the tool generates. Hope you find it useful.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;IMG title=FDS style="WIDTH: 956px; HEIGHT: 543px" height=543 alt=FDS hspace=2 src="http://farm3.static.flickr.com/2402/2387235355_6c8c8f3565_o_d.jpg" width=956 align=absMiddle vspace=2 border=2 mce_src="http://farm3.static.flickr.com/2402/2387235355_6c8c8f3565_o_d.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8357773" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/kcwalina/attachment/8357773.ashx" length="393197" type="application/vnd.openxmlformats-officedocument.word" /><category domain="http://blogs.msdn.com/kcwalina/archive/tags/Design+Guidelines/default.aspx">Design Guidelines</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Job Openings on the .NET Framework Core Team</title><link>http://blogs.msdn.com/kcwalina/archive/2008/03/14/8209671.aspx</link><pubDate>Fri, 14 Mar 2008 22:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8209671</guid><dc:creator>kcwalina</dc:creator><slash:comments>15</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/8209671.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=8209671</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=8209671</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;We have been incubating ideas about building a simple extensibility framework for some time. Now, as plans for the next version of the .NET Framework crystallize a bit more, we decided to productize the project. As a result, we have opened a job position (and most probably will be opening more) on the .NET Framework team. If you are interested, please see details &lt;/FONT&gt;&lt;A href="http://members.microsoft.com/careers/search/details.aspx?JobID=508DA780-65F1-480C-B831-F72A0FAA91E9&amp;amp;start=1&amp;amp;interval=10&amp;amp;SortCol=DatePosted"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; and send me an email at “kcwalina at microsoft.com.”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;So, what is this extensibility framework? Initially, it will be a low level core .NET Framework feature to make it easy for applications to expose extensibility points and consume extensions. Think about what for example FxCop has to do define rule contracts and load rule implemented by the community&lt;B&gt;&lt;I&gt;&lt;SPAN style="COLOR: #943634"&gt;. &lt;/SPAN&gt;&lt;/I&gt;&lt;/B&gt;These are the basics, and we can talk about the broader and longer term vision when you come to Redmond for an interview :-)&lt;B&gt;&lt;I&gt;&lt;SPAN style="COLOR: #943634"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #943634"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;This is a technical Program Manager position&lt;B&gt;&lt;I&gt; &lt;/I&gt;&lt;/B&gt;in Redmond, WA, and it’s basically exactly the job I did when I joined Microsoft. Besides working on the Framework features, all Program Managers on the core team have opportunities to work on API design and architecture projects.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8209671" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/Design+Guidelines/default.aspx">Design Guidelines</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Video Recording of "Framework Engineering: Architecting, Designing, and Developing Reusable Libraries"</title><link>http://blogs.msdn.com/kcwalina/archive/2008/01/08/FrameworkEngineering.aspx</link><pubDate>Tue, 08 Jan 2008 21:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7031258</guid><dc:creator>kcwalina</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/7031258.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=7031258</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=7031258</wfw:comment><description>&lt;SPAN style="COLOR: #0070c0; FONT-FAMILY: 'Arial Narrow','sans-serif'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;FONT color=#000000&gt;I just&amp;nbsp;received&amp;nbsp;a video recording of a talk I did at the last TechEd. You can find the abstract below, and the WMV file can be downloaded from &lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/b/d/1/bd133733-9647-445f-bc06-238ae9c0dd48/FrameworkEngineering.wmv" mce_href="http://download.microsoft.com/download/b/d/1/bd133733-9647-445f-bc06-238ae9c0dd48/FrameworkEngineering.wmv"&gt;here&lt;/A&gt;&lt;FONT color=#000000&gt;. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;FONT color=#000000&gt;Hope you find it useful.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;FONT color=#000000&gt;[UPDATE: I attched the slides in xps format. The ppt file is 10x larger]&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; COLOR: #0070c0; FONT-FAMILY: 'Arial Narrow','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;EM&gt;Framework Engineering: Architecting, Designing, and Developing Reusable Libraries&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; COLOR: #0070c0; FONT-FAMILY: 'Arial Narrow','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;EM&gt;This session covers the main aspects of reusable library design: API design, architecture, and general framework engineering processes. Well-designed APIs are critical to the success of reusable libraries, but there are other aspects of framework development that are equally important, yet not widely covered in literature. Organizations creating reusable libraries often struggle with the process of managing dependencies, compatibility, and other design processes so critical to the success of modern frameworks. Come to this session and learn about how Microsoft creates its frameworks. The session is based on experiences from the development of the .NET Framework and Silverlight, and will cover processes Microsoft uses in the development of managed frameworks.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7031258" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/kcwalina/attachment/7031258.ashx" length="1315748" type="application/vnd.ms-xpsdocument" /><category domain="http://blogs.msdn.com/kcwalina/archive/tags/Design+Guidelines/default.aspx">Design Guidelines</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>What Do Swimmers Have to Say About Framework Design?</title><link>http://blogs.msdn.com/kcwalina/archive/2007/10/04/TechEdBarcelona.aspx</link><pubDate>Fri, 05 Oct 2007 03:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5280111</guid><dc:creator>kcwalina</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/5280111.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=5280111</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=5280111</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I am starting to feel pressure to finish up slides for my presentation at the upcoming TechEd in Barcelona. I will be talking about framework architecture and design. Here is the abstract I took from the &lt;/FONT&gt;&lt;A href="http://www.mseventseurope.com/teched/07/developers/content/Pages/Default.aspx"&gt;&lt;FONT face=Calibri size=3&gt;conference’s site&lt;/FONT&gt;&lt;/A&gt;:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="COLOR: #0070c0; FONT-FAMILY: 'Arial Narrow','sans-serif'"&gt;&lt;FONT size=3&gt;WIN304 Framework Engineering: Architecting, Designing, and Developing Reusable Libraries&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;SPAN style="COLOR: #0070c0; FONT-FAMILY: 'Arial Narrow','sans-serif'"&gt;&lt;FONT size=3&gt;This session covers the main aspects of reusable library design: API design, architecture, and general framework engineering processes. Well-designed APIs are critical to the success of reusable libraries, but there are other aspects of framework development that are equally important, yet not widely covered in literature. Organizations creating reusable libraries often struggle with the process of managing dependencies, compatibility, and other design processes so critical to the success of modern frameworks. Come to this session and learn about how Microsoft creates its frameworks. The session is based on experiences from the development of the .NET Framework and Silverlight, and will cover processes Microsoft uses in the development of managed frameworks.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I am super excited about the talk, which I want to make into a continuation to the API design pre-con I did with &lt;A class="" href="http://blogs.msdn.com/brada" mce_href="http://blogs.msdn.com/brada"&gt;Brad Abrams&lt;/A&gt; at the last PDC (BTW, the same content is available &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/kcwalina/archive/2007/03/29/1989896.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;). The PDC talk was about designing the API surface, but there is so much more to framework design!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I am also excited coming back to the wonderful city of Barcelona. Last time I was there, believe it or not, I was on the Polish swimming team competing in the Olympics (&lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Swimming_at_the_1992_Summer_Olympics_-_Men%27s_4_x_200_metre_freestyle_relay"&gt;&lt;FONT face=Calibri size=3&gt;see #13&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;). I hope this trip will bring back some memories from the other and completely different “career” I had in the past.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5280111" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>FxCop Rule for Multi-Targeting</title><link>http://blogs.msdn.com/kcwalina/archive/2007/10/02/Multi_2D00_TargetingAndFxCop.aspx</link><pubDate>Wed, 03 Oct 2007 02:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5249710</guid><dc:creator>kcwalina</dc:creator><slash:comments>22</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/5249710.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=5249710</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=5249710</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Two months ago, Scott blogged about &lt;/FONT&gt;&lt;A href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx"&gt;&lt;FONT face=Calibri size=3&gt;the multi-targeting support in Visual Studio 2008&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;. I worked on this feature in the planning phase (read “long time ago”), and so I am quite thrilled to see it finally in the hands of developers. Especially, that several years ago I remember our small working group sitting in a room and wondering whether such feature was even possible. The complexities of implementing it in a large project like the Visual Studio seemed quite daunting. &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The thing that made implementing multi-targeting in one release possible was the concept of Red and Green bits. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;You can read about the concept &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/somasegar/archive/2006/05/18/601354.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;, &lt;A class="" href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html" mce_href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html"&gt;here&lt;/A&gt;, and&amp;nbsp;&lt;A class="" href="http://blogs.msdn.com/jasonz/archive/2006/05/21/603544.aspx" mce_href="http://blogs.msdn.com/jasonz/archive/2006/05/21/603544.aspx"&gt;here&lt;/A&gt;, but quickly: red bits are Framework assemblies that existed in the .NET Framework 2.0 and were serviced in versions 3.0 and 3.5. Green bits are assemblies that were added either in the version 3.0 or 3.5. The servicing changes in Red bit APIs are limited (after all it is servicing) to a very small number of API additions and bug fixes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;We leveraged (and influenced) the decision to limit the number of changes to existing assemblies to drastically simplify the requirements for the multi-targeting system. That is, we made an assumption that the majority of differences between the Framework versions (targets) are on assembly boundaries.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;But now I have to confess, there are some limitations in this design that we accepted when we made the original simplifying assumption. There is a very limited number of APIs being added to the Red assemblies and the multi-targeting system is currently not able to detect these. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;For example, if you set the target to the .NET Framework 2.0 and read the newly-added (albeit obscure) property GCSettings.LatencyMode the program will compile just fine but then fail to run on the .NET Framework 2.0 RTM. The reason is that the property was added to an existing (Red) class GCSettings, not to a new class in a new assembly. Despite that the number of such additional APIs in Red bits is very small (and that we recommend that you still test your programs on all targeted platforms), this can be quite annoying. And so feeling a bit responsible for this (and trying to promote FxCop &lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;&lt;SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;), I wrote an FxCop rule that can analyze IL of an assembly targeted at Framework 2.0 and warn you about all calls to members that are not present in 2.0 RTM. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Here is how it works: The test program below uses new LatencyMode enum and calls a new GcSettings.LatencyMode property. As I mentioned above, these APIs don’t exist in .NET Framework 2.0 RTM. Even if I built this project with the multi-targeting target set to Framework 2.0, the system would not complain about calling these APIs. But, as you can see in the error list, the FxCop analysis engine can deal even with this difficult to detect problem. You can think of the rule as a very smart (post) compiler-step.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;&lt;v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG src="http://farm2.static.flickr.com/1250/1473897382_374fc28d10_o_d.jpg" mce_src="http://farm2.static.flickr.com/1250/1473897382_374fc28d10_o_d.jpg"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;A&amp;nbsp;sample project with the rule is attached to this post&lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;. I provide it without any guarantees, as is, and in fact I am sure it has many bugs and problems. When I find time, I will work on it more to polish it a bit but I don't promise (i.e. treat it as a sample).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;BTW, to install the rule, just build it and drop it to the FxCop rules directory. On my machine it is at C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Rules. In addition you have to go to Project settings of the project you want to analyze and turn on FxCop analysis (the “Code Analysis” tab in the project properties). Lastly, you can either rebuild or right click on a project and choose “Run Code Analysis”. I hope it’s helpful.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5249710" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/kcwalina/attachment/5249710.ashx" length="42235" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Duck Notation</title><link>http://blogs.msdn.com/kcwalina/archive/2007/07/18/DuckNotation.aspx</link><pubDate>Wed, 18 Jul 2007 21:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3927426</guid><dc:creator>kcwalina</dc:creator><slash:comments>36</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/3927426.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=3927426</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=3927426</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;I have been working with the C# and VB teams on design guidelines for LINQ. We started to talk about the so called &lt;I style="mso-bidi-font-style: normal"&gt;Query Pattern&lt;/I&gt;, which describes what you need to do if you want a custom type to support the new query operators (select, where, group by, etc.). &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;The query operators use &lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Duck_typing" mce_href="http://en.wikipedia.org/wiki/Duck_typing"&gt;&lt;FONT face=Calibri size=3&gt;duck typing&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; to determine whether they can operate on a type or not. This means that instead of implementing an interface (static typing) a &lt;I style="mso-bidi-font-style: normal"&gt;queryable type&lt;/I&gt; will need to have a set of members that follow a specified set of conventions (naming, parameter and return types, etc). &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;For example, the C#’s foreach operator already uses duck typing. This might be surprising to some, but to support foreach in C# you don’t need to implement IEnumerable! All you have to do is: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;Provide a public method GetEnumerator that takes no parameters and returns a type that has two members: a) a method MoveMext that takes no parameters and return a Boolean, and b) a property Current with a getter that returns an Object.&lt;/SPAN&gt; &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;For example, the following type supports foreach:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;class Foo {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public Bar GetEnumerator() { return new Bar(); }&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public struct Bar {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public bool MoveNext() {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return false;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public object Current {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get { return null; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;// the following complies just fine:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;Foo f = new Foo();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;foreach (object o in f) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine(“Hi!”);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;But, as you can see in the yellow highlight above, the describing the foreach pattern in English (or any other spoken language) is quite difficult and not very readable, especially if you contrast it with the simplicity specifying requirements based on static typing: &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;Implement IEnumerable.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;&lt;FONT face=Calibri&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT size=3&gt;… and having IEnumerable defined as:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;public interface IEnumerable {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public IEnumerator GetEnumerator();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;public interface IEnumerator {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public bool MoveMext();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public object Current { get; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;The english description&amp;nbsp;gets much worse for something like the query pattern, which is way more complex than the foreach pattern. &lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;Because of that, I was thinking that there must be a better way to specify such patterns based on duck typing. But when I searched the web, to my surprise, I could not find any simple notations to do that. If you know of any, please let me know.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;In the absence of an existing notation, I started to think about something like the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;[Foreachable] {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public [Enumerator] GetEnumerator();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;[Enumerator] {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public bool MoveMext();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public [ItemType] Current { get; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;This seems much easier to parse than the English description of the pattern. What do you think? &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3927426" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/Design+Guidelines/default.aspx">Design Guidelines</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>How to Fight Complexity in Software (part I)</title><link>http://blogs.msdn.com/kcwalina/archive/2007/07/17/MQ.aspx</link><pubDate>Wed, 18 Jul 2007 02:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3925519</guid><dc:creator>kcwalina</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/3925519.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=3925519</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=3925519</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0.25in"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;A couple of weeks ago, &lt;A class="" href="http://www.booch.com/architecture/blog.jsp" mce_href="http://www.booch.com/architecture/blog.jsp"&gt;Grady Booch&lt;/A&gt; gave a lecture at Microsoft. It was a pleasure to hear of my software engineering heroes in person. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Grady talked about “the promise, the limits, and the beauty of software.” &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0.25in"&gt;&lt;FONT face=Calibri size=3&gt;The main thing that captured my interest during the lecture was a discussion about the &lt;U&gt;cost of complexity&lt;/U&gt; in software. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0.25in"&gt;&lt;FONT face=Calibri size=3&gt;Grady said that there are many factors influencing the cost of software, but two of these factors have disproportionally high impact on the overall cost: a) the processes used to develop and maintain the software, b) the complexity of the codebase. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;To fight growing complexity of the codebase, many companies allocate some percentage of their resources for refactoring, cleanup, and other activities that don’t directly result in features for the end user of the software. This really resonated with me. I am a huge fan of this approach. We do some of it here in the developer division (read about the MQ milestones &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/somasegar/archive/2005/11/08/490694.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/eric/archive/2005/11/04/489108.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;, and &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/anutthara/archive/2006/02/23/537825.aspx"&gt;&lt;FONT face=Calibri size=3&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;), but I wish we and software industry in general did even more.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3925519" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>FxCop Designers Honored with the Chairman's Award</title><link>http://blogs.msdn.com/kcwalina/archive/2007/07/03/EEAward.aspx</link><pubDate>Wed, 04 Jul 2007 02:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3677999</guid><dc:creator>kcwalina</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/3677999.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=3677999</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=3677999</wfw:comment><description>&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;
&lt;P class=MsoNormal style="MARGIN: 24pt 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Last week, during the annual Engineering Excellence week, several Microsoft engineers and managers involved in development of engineering tools and practices were presented with Engineering Excellence Awards. In addition, the principal designers of three static analysis tools were honored with so called “Engineering Excellence Chairman’s Award,” which is given for contributions that our chairman (Bill) considers especially important. The Chairman award was given twice in the history of Microsoft.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 24pt 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Mike Fanning, &lt;A class="" href="http://blogs.msdn.com/brada/" mce_href="http://blogs.msdn.com/brada/"&gt;Brad Abrams&lt;/A&gt;, and I received nice glass statuettes and a framed &lt;A class="" href="http://farm2.static.flickr.com/1273/709216423_8f7793a7c9_o_d.jpg" mce_href="http://farm2.static.flickr.com/1273/709216423_8f7793a7c9_o_d.jpg"&gt;letters&lt;/A&gt; from Bill and Jon (our VP responsible for EE). See pictures below. The letter says “The Engineering Excellence Chairman’s Award is the Microsoft’s highest award for engineering group employees worldwide.” &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 24pt 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;It’s extremely rewarding to receive something like that for what started as a hobby project on which we worked mainly in our free time (at least, before it was officially productized). I would like to thank Brad for being the “let’s do it now” person, pushing the whole effort of design guidelines and fxcop development, and Mike for his passion for quality and being the super-developer on the team.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 24pt 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;Of course, many others contributed to the success of fxcop. Once we gather all the names, we will post a new entry or update this one to thank everybody and record all the contributions for posterity. [UPDATE: Brad just posted&amp;nbsp;on this &lt;A class="" href="http://blogs.msdn.com/brada/archive/2007/07/05/fxcop-honored-with-chairman-s-award-for-engineering-excellence.aspx" mce_href="http://blogs.msdn.com/brada/archive/2007/07/05/fxcop-honored-with-chairman-s-award-for-engineering-excellence.aspx"&gt;here&lt;/A&gt;.]&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 24pt 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;IMG src="http://farm2.static.flickr.com/1425/710089160_e7ec30923e_o_d.jpg" mce_src="http://farm2.static.flickr.com/1425/710089160_e7ec30923e_o_d.jpg"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3677999" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Generic Methods as Casts</title><link>http://blogs.msdn.com/kcwalina/archive/2007/06/07/GenericMethodsAsCasts.aspx</link><pubDate>Thu, 07 Jun 2007 20:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3145835</guid><dc:creator>kcwalina</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/3145835.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=3145835</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=3145835</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;Somebody just asked me which of the following API design alternatives is better. They both do what we could call “casting.”&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;// Generic Method&lt;SPAN style="mso-bidi-font-size: 10.0pt"&gt; “Cast”&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt"&gt;var foo&lt;/SPAN&gt; = someInstance.SomeMethod&amp;lt;IFoo&amp;gt;();&lt;SPAN style="mso-bidi-font-size: 10.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;// Simple Cast&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt"&gt;var foo = (IFoo)&lt;/SPAN&gt;someInstance.SomeMethod();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;The Generic method approach can potentially have two benefits. A constraint can tell users what the subset of valid casts is. For example, the following API will allow casts to a collection (a subtype of IEnumerable):&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Consolas size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;public TCollection SomeMethod&amp;lt;TCollection&amp;gt;() where TCollection:IEnumerable {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;…&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;} &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;If the user calls this method and tries to “cast” the return value to let’s say an Int32, the compiler with complain. For example,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Consolas size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;var int someInstance.SomeMethod&amp;lt;int&amp;gt;(); &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;… will generate the following error:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Consolas size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;The type 'int' must be convertible to 'System.Collections.IEnumerable' in order to use it as parameter 'TCollection' in the generic type or method 'SomeClass.SomeMethod&amp;lt;TCollection&amp;gt;()'&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;Secondly, the Generic method might do different things based on the type parameter. The method relying on a simple cast has now knowledge about the type the user will cast it’s return value to.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Consolas size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;public TCollection SomeMethod&amp;lt; TCollection &amp;gt;() &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;where TCollection:IEnumerable,new() {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Lucida Console"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;TCollection newCollection = new TCollection ();&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ArrayList newArray = newCollection as ArrayList;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if (newArray != null) newArray.Capacity = 0;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return newCollection;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Code style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Lucida Console"&gt;}&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 12pt 0.3in 3pt 0in"&gt;&lt;FONT face=Calibri size=3&gt;If neither of these benefits applies in your case, I would use a simple cast. It’s more transparent in terms of what’s going on. The users of a generic method might wonder what kind of “magic” is being done with the generic type parameter. &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3145835" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Silverlight - Program the Web the Way YOU Want It</title><link>http://blogs.msdn.com/kcwalina/archive/2007/05/05/Silverlight.aspx</link><pubDate>Sat, 05 May 2007 19:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2430447</guid><dc:creator>kcwalina</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/2430447.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=2430447</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=2430447</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;I just came back from &lt;/FONT&gt;&lt;A href="http://visitmix.com/"&gt;&lt;FONT face=Calibri&gt;Mix&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt; where we announced details of &lt;/FONT&gt;&lt;A href="http://silverlight.net/"&gt;&lt;FONT face=Calibri&gt;Silverlight&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;’s programming model. This is pretty much what I have been working on for the last year and a half. It feels great to finally be able to talk about it. I will blog more about the details after I am back from my well deserved vacation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;But more importantly, I am supper excited that there is finally a &lt;U&gt;real&lt;/U&gt; programming model for the Web. I am a system software developer, and to me, all existing web programming models felt like smaller or larger hacks. They are all based on technologies invented for something other than writing applications, but adopted to these scenarios over the years. For example, HTML was invented for representing documents with hyperlinks. This is quite natural for immature technologies, so I am not blaming anybody here :-).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;When Silverlight’s vision started to crystallize, we realize that we have an opportunity to do the Web programming model right this time:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Modern programming languages&lt;/B&gt;: In Silverlight, you can program using your .NET language of choice, whether it’s a traditional OO language like C#, VB.NET, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;or C++, a dynamic language like &lt;/FONT&gt;&lt;A href="http://www.ironpython.com/"&gt;&lt;FONT face=Calibri&gt;IronPython&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt; or &lt;/FONT&gt;&lt;A href="http://www.wilcob.com/Wilco/IronRuby.aspx"&gt;&lt;FONT face=Calibri&gt;IronRuby&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;, or a functional language like &lt;/FONT&gt;&lt;A href="http://research.microsoft.com/fsharp/fsharp.aspx"&gt;&lt;FONT face=Calibri&gt;F#&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;, … or choose from the plethora other &lt;/FONT&gt;&lt;A href="http://dotnetpowered.com/languages.aspx"&gt;&lt;FONT face=Calibri&gt;3&lt;SUP&gt;rd&lt;/SUP&gt; party languages&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;State of the art markup&lt;/B&gt;: &lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/XAML"&gt;&lt;FONT face=Calibri&gt;XAML&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt; really shines when you need the ultimate flexibility in representing graphics and GUI.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;First class garbage collected runtime&lt;/B&gt;:&lt;B style="mso-bidi-font-weight: normal"&gt; &lt;/B&gt;The runtime included in Silverlight (“Core CLR”) is basically the .NET Framework’s runtime with features irrelevant to the web programming removed (e.g. COM Interop).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Large ecosystem of tools, information, and services&lt;/B&gt;: Silverlight’s type system is the same CIL type system used in .NET and the Silverlight Framework is simply a subset of the .NET Framework. This means the most if not all .NET Framework tools work or can be easily adopted to Silverlight. This includes Visual Studio, &lt;/FONT&gt;&lt;A href="http://www.gotdotnet.com/Team/FxCop/"&gt;&lt;FONT face=Calibri&gt;FxCop&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;, &lt;/FONT&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/"&gt;&lt;FONT face=Calibri&gt;.NET Reflector&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;, MSDN, and new specialized tools like the excellent &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/expression/products/overview.aspx?key=blend"&gt;&lt;FONT face=Calibri&gt;Expression Blend&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri&gt;I already wrote a couple of small applications using Silverlight, and I have to say that it makes web programming &lt;U&gt;natural&lt;/U&gt; for the first time. The platform no longer forces you to program its way, while your intuition and years of programming experience tell you to code some other way. It makes me say, for the first time in my life, that I am proud to be a web developer :-)&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2430447" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Nourishing Creativity</title><link>http://blogs.msdn.com/kcwalina/archive/2007/04/24/NourishingCreativity.aspx</link><pubDate>Wed, 25 Apr 2007 03:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2266250</guid><dc:creator>kcwalina</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/2266250.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=2266250</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=2266250</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;For those who haven’t heard about it, &lt;/FONT&gt;&lt;A href="http://www.ted.com/" mce_href="http://www.ted.com/"&gt;&lt;FONT face=Calibri size=3&gt;TED&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; is a multidisciplinary conference for experts from technology, entertainment, and design industries. They just updated their web site and while browsing around it I found this very interesting &lt;/FONT&gt;&lt;A href="http://www.ted.com/index.php/talks/view/id/66" mce_href="http://www.ted.com/index.php/talks/view/id/66"&gt;&lt;FONT face=Calibri size=3&gt;presentation&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; about creativity by Ken Robinson. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;One of the main points Ken makes is that penalizing people for failing when they try new things is killing creativity. His talk concentrates on education systems, but I think the same mechanisms exist in the industry. &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2266250" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>Effective Presentation Skills</title><link>http://blogs.msdn.com/kcwalina/archive/2007/02/01/EffectivePresentationSkills.aspx</link><pubDate>Fri, 02 Feb 2007 04:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1578896</guid><dc:creator>kcwalina</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/1578896.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=1578896</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=1578896</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri color=#0f243e size=3&gt;I&amp;nbsp;just watched&amp;nbsp;a very&amp;nbsp;interesting &lt;A class="" href="http://video.google.com/videoplay?docid=4237353244338529080&amp;amp;sourceid=searchfeed" mce_href="http://video.google.com/videoplay?docid=4237353244338529080&amp;amp;sourceid=searchfeed"&gt;presentation&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Calibri color=#0f243e size=3&gt;. The content of the presentation is interesting, but not very relevant to the work software engineers do. The super interesting and relevant part is that it’s one of the best presentations I have ever seen in terms of&amp;nbsp;the mechanics of presenting,&amp;nbsp;and I think all who do presentations can learn a lot from it. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri color=#0f243e size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT color=#0f243e&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The presenter wanted to communicate just one relatively simple thing that not many people pay attention to, so he had to capture the audience’s attention and he did a very good job doing it.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT color=#0f243e&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The presentation has lots of content, but the content is just to support the main thesis; it's not a laundry list of things he wanted people to remember (that it almost never &lt;SPAN style="FONT-SIZE: 11pt; COLOR: #0f243e; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: Arial; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-theme-font: minor-latin; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;successful&lt;/SPAN&gt;).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT color=#0f243e&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The presentation shows the power of visual communication (and software). The same information presented in a static table, bullets, etc. would completely fail in communicating the main message.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1578896" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>How to Design Exception Hierarchies</title><link>http://blogs.msdn.com/kcwalina/archive/2007/01/30/ExceptionHierarchies.aspx</link><pubDate>Tue, 30 Jan 2007 22:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1558767</guid><dc:creator>kcwalina</dc:creator><slash:comments>14</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/1558767.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=1558767</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=1558767</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I still get a lot of questions on how to design exception hierarchies, despite several attempts to describe it in talks, the FDG book, and in posts on this blog. Maybe the guidance gets lots in the in the complexities of the full guidance surrounding exception handling or I am a bad communicator. Let me assume the former :-), and so here is one more attempt at describing the guidance in the most succinct way I am capable of:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;For each error condition you reusable routine can get into, decide whether the condition is a usage error or a system error.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;A &lt;STRONG&gt;usage error&lt;/STRONG&gt; is something that can be avoided by changing the code that calls your routine. For example, if a routine gets into an error state when a null is passed as one of its arguments (error condition usually represented by an ArgumentNullException), the calling code can modified by the developer to ensure that null is never passed. In other words the developer can ensure that usage errors never occur.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;A &lt;STRONG&gt;system error&lt;/STRONG&gt; is something that cannot be avoided by simply writing code that tries to avoid the error condition. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;For example, File.Open gets into an error condition when it tries to open a file that does not exist (and it throws FileNotFoundException). This error condition cannot be fully avoided. Even if you check whether the file exists before calling File.Open, the file can get deleted or corrupted between the call to File.Exists and the call to File.Open.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Usage errors need to be communicated to the human developer calling the routine. The exception type&amp;nbsp;is not the best way to communicate errors to humans. The message string is a much better way. Therefore, for exceptions that are thrown as a result of usage errors, I would concentrate on designing a really good (that is explanatory) exception message and using one of the existing .NET Framework exception types: ArgumentNullException, ArgumentException, InvalidOperationException, NotSupportedException, etc. In other words, don’t create new exception types for usage errors because the type of the exception does not matter for usage errors. The .NET Framework already has enough types (actually too many, IMHO) to represent every usage error I can think of.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;System errors need to be further divided into two groups:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;&lt;STRONG&gt;Logical errors&lt;/STRONG&gt; are system errors that can be handled programmatically. For example, if File.Open throws FileNotFoundException, the calling code can catch the exception and handle it by creating a new file. (Side note: this is in contrast to the usage error described above where you would never first pass a null argument, catch the NullArgumentException, and this time pass a non-null argument).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;&lt;STRONG&gt;System failures&lt;/STRONG&gt; are system errors that cannot be handled programmatically. For example, you really cannot handle out of memory exception resulting from the JIT running out of memory.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;System failures should result in the shutdown of the process. This might sound scary at the first read, but I would say it's by-definition: a system failure is an error that can neither be handled by the developer or the program. The best way to shut down a process in such cases is to call Environment.FailFast, which logs the state of the system, and that is very useful in diagnosing the problem. The good thing is that system failures are extremely rare in reusable libraries. They are mostly caused by the execution engine.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Logical errors are errors that can be, and often are, handled in code. The way to handle such errors is to catch the exception and execute some “compensating” logic. Whether the catch statement executes&amp;nbsp;is determined by&amp;nbsp;the type of the exception the catch block claims&amp;nbsp;it can handle. This means that logical errors are&amp;nbsp;are condition (and actually the only&amp;nbsp;conditions) where the exception type matters and when you should consider creating a new exception type. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If you think you are dealing with a logical error, I would validate this belief by actually writing code or describing very precisely what would the catch handler do when it catches the exception to allow the program to continue its execution. If you cannot describe it or the error can be avoided by changing the calling code, you are dealing with a usage error or a system failure. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Note that logical errors are still pretty rare. As a rule of thumb, I would say that error conditions in a typical reusable library fall into: &amp;lt;1% of system failures, 5% logical errors, and the rest ~95%&amp;nbsp;are usage errors.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If you are convinced that your error is a logical error, you need to decide whether to reuse one of the existing exception types from the framework or create a new exception type.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;You should use an existing Framework exception is both of the following are true&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The exception type makes sense for your error condition. For example, you don’t want to throw FileNotFoundException if your threadpool implementation runs out of the thread quota.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;The exception will not make an error condition ambiguous. That is, the code that wants to handle the specific error will always be able to tell whether the exception was thrown because of the error or because of some other error that happens to use the same exception. For example, you don’t want to throw (reuse) FileNotFoundException from a routine that calls Framework’s file I/O APIs that can throw the same exception, unless it does not matter to the calling code whether your code or the Framework threw the exception (BTW, it’s quite often that it does not matter).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If you decided not to reuse an exception type from the .NET Framework, you will have to create a new exception type. When you create a new exception type, as a rule of thumb, I would simply inherit it from System.Exception or from a single subtype of System.Exception representing custom exceptions declared in your component/framework. I would create the root only if you have more than 3 custom exceptions. There are limited cases where it’s good to create a more elaborate hierarchy, but it’s extremely rare. I would say in a typical library 99% of custom exceptions should follow this guidance. The reason is that when you catch exceptions you almost never care about the hierarchy. You almost never care about the hierarchy because you almost never want to catch more than one error at a time. You almost never want to handle more than one error at a time, because if the errors could be handled the same way, they should not be expressed using two different exception types. Now, please note that I said “almost” and “should” in several places. You your case falls into the small number of corner cases, you need to create a deeper hierarchy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Lastly, keep in mind that it’s not a breaking change to change an exception your code throws to a subtype of the exception. For example, if the first version of your library throws FooException, in any future version of your library, you can start throwing a subtype for FooException without breaking code that was compiled against the previous version of your library. This means, when in doubt, I would consider not creating new exception types till you are sure you need them. At which point, you can create a new exception type by inheriting from the currently throw type. Sometimes it might result in slightly strange exception hierarchy (for example, a custom exception inheriting from InvalidOperationException), but it’s not a big deal in comparison to the cost having unnecessary exception types in your library, which makes the library more complex, adds development cost, increases working set, etc.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1558767" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/Design+Guidelines/default.aspx">Design Guidelines</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item><item><title>.NET Framework Performance Signatures</title><link>http://blogs.msdn.com/kcwalina/archive/2007/01/26/PerformanceSignatures.aspx</link><pubDate>Sat, 27 Jan 2007 03:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1539728</guid><dc:creator>kcwalina</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/kcwalina/comments/1539728.aspx</comments><wfw:commentRss>http://blogs.msdn.com/kcwalina/commentrss.aspx?PostID=1539728</wfw:commentRss><wfw:comment>http://blogs.msdn.com/kcwalina/rsscomments.aspx?PostID=1539728</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;I love Rico’s performance quizzes in general, but &lt;A class="" href="http://blogs.msdn.com/ricom/archive/2007/01/24/performance-quiz-12-the-cost-of-a-good-hash-some-help.aspx" mce_href="http://blogs.msdn.com/ricom/archive/2007/01/24/performance-quiz-12-the-cost-of-a-good-hash-some-help.aspx"&gt;the last one&lt;/A&gt; has something especially interesting: a link to a file listing all members in the Framework and their estimated performance signatures (perf characteristic based on the number of allocations in the member).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Now, I only wish I had an &lt;A class="" href="http://www.gotdotnet.com/team/fxcop/" mce_href="http://www.gotdotnet.com/team/fxcop/"&gt;fxcop&lt;/A&gt; rule warning me when I call some of the expensive members in loops, low on the callstack, on the UI thread, or in any other performance sensitive places. &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1539728" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+API+Design/default.aspx">General API Design</category><category domain="http://blogs.msdn.com/kcwalina/archive/tags/General+Programming/default.aspx">General Programming</category></item></channel></rss>