<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://consultingblogs.emc.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>Anthony Steele's Blog : code review</title><link>http://consultingblogs.emc.com/anthonysteele/archive/tags/code+review/default.aspx</link><description>Tags: code review</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Oxite</title><link>http://consultingblogs.emc.com/anthonysteele/archive/2008/12/21/oxite.aspx</link><pubDate>Sun, 21 Dec 2008 21:14:00 GMT</pubDate><guid isPermaLink="false">e847c0e7-38d9-45c0-b593-56747303e088:13754</guid><dc:creator>Anthony.Steele</dc:creator><slash:comments>1</slash:comments><comments>http://consultingblogs.emc.com/anthonysteele/comments/13754.aspx</comments><wfw:commentRss>http://consultingblogs.emc.com/anthonysteele/commentrss.aspx?PostID=13754</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;Today I am looking at &amp;nbsp;Oxite. Not &lt;A href="http://en.wikipedia.org/wiki/John_the_Oxite"&gt;&lt;SPAN style="COLOR:blue;"&gt;this Oxite&lt;/SPAN&gt;&lt;/A&gt;, but &lt;A href="http://www.codeplex.com/oxite"&gt;&lt;SPAN style="COLOR:blue;"&gt;this Oxite&lt;/SPAN&gt;&lt;/A&gt;. It’s a sample application on the &lt;A href="http://www.asp.net/mvc/"&gt;&lt;SPAN style="COLOR:blue;"&gt;ASP.NET MVC&lt;/SPAN&gt;&lt;/A&gt; platform. It’s a blog engine, so it’s doubly interesting to me. New MVC blogging engines crop up on CodePlex every month or so (and I have contributed code to &lt;A href="http://www.codeplex.com/blogsvc"&gt;&lt;SPAN style="COLOR:blue;"&gt;BlogSvc&lt;/SPAN&gt;&lt;/A&gt;). Generally they pass without much (or any) notice.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;Oxite, however, arrived with an impressive degree of completeness, and generated a lot of publicity. Not all of it was accurate – &lt;A href="http://www.theregister.co.uk/2008/12/09/microsoft_oxite_blogging_platform/"&gt;&lt;SPAN style="COLOR:blue;"&gt;some seemed to think&lt;/SPAN&gt;&lt;/A&gt; it was a major new part of Microsoft’s internet strategy rather than a sample app by a couple of guys at Microsoft. As it stands, it's not a competitor to &lt;A href="http://wordpress.org/"&gt;&lt;SPAN style="COLOR:blue;"&gt;WordPress&lt;/SPAN&gt;&lt;/A&gt;. I like WordPress, I have deployed and configured it and several times. While I'd like something like that which I can also hack in C#, Oxite is not there. Yet.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;Code reviews followed. See Rob Connery's blog, &lt;A href="http://blog.wekeroad.com/blog/some-thoughts-on-oxite/"&gt;&lt;SPAN style="COLOR:blue;"&gt;here&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;and &lt;A href="http://blog.wekeroad.com/blog/oxite-refactor-take-1/"&gt;&lt;SPAN style="COLOR:blue;"&gt;here&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;for details. Oxite is clearly not ready for general use as finished software, it’s not even ready as a best-of breed code sample, but developers may be interested. Oxite has a few code issues (see Rob Connery’s links above), but it's also got advantages:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;Advantage 1: The guys who wrote it have put a lot of time and work into it - they can afford to, it's part of their day job.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;Advantage 2: Oxite got instant publicity and community, including a code review from Rob Connery, and lots of other people poking at it- orders of magnitude more downloads and comments than the other MVC&amp;nbsp;blog engines on codeplex got, combined.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;I'm watching Oxite with interest - I want to know if they will take the advice on board, and will it become more than just a "sample app".&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;A class="" href="http://blogs.conchango.com/anthonysteele/archive/2008/12/22/adding-openid-to-oxite-part-1.aspx"&gt;Next time&lt;/A&gt; I will show&amp;nbsp;putting &lt;A href="http://openid.net/"&gt;&lt;SPAN style="COLOR:blue;"&gt;OpenId&lt;/SPAN&gt;&lt;/A&gt; support into Oxite, with help from &lt;A href="http://code.google.com/p/dotnetopenid/"&gt;&lt;SPAN style="COLOR:blue;"&gt;DotNetOpenId&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&amp;nbsp;and sample code from Rob Connery via a few of my colleagues.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;LINE-HEIGHT:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Times New Roman','serif';mso-fareast-font-family:'Times New Roman';mso-fareast-language:EN-GB;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&gt;&lt;SPAN style="FONT-FAMILY:'Times New Roman','serif';"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=13754" width="1" height="1"&gt;</description><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code/default.aspx">code</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/blog/default.aspx">blog</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+review/default.aspx">code review</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/.Net/default.aspx">.Net</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/mvc/default.aspx">mvc</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/oxite/default.aspx">oxite</category></item><item><title>A method should have only one return statement. Discuss.</title><link>http://consultingblogs.emc.com/anthonysteele/archive/2008/07/14/a-method-should-have-only-one-return-statement-discuss.aspx</link><pubDate>Mon, 14 Jul 2008 14:56:00 GMT</pubDate><guid isPermaLink="false">e847c0e7-38d9-45c0-b593-56747303e088:11833</guid><dc:creator>Anthony.Steele</dc:creator><slash:comments>0</slash:comments><comments>http://consultingblogs.emc.com/anthonysteele/comments/11833.aspx</comments><wfw:commentRss>http://consultingblogs.emc.com/anthonysteele/commentrss.aspx?PostID=11833</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;CODE&gt;&lt;FONT face="Times New Roman" size=3&gt;I heard again recently that "A method should have only one return statement" and of "The single-return law", that more than one return was a poor coding practice. I disagree. &lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;CODE&gt;&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;CODE&gt;public int IsThisCodeSoBad(int param)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; if (param == 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp; foreach(foo in bar)&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If foo.fish()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/CODE&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp; return 2;&lt;BR&gt;}&lt;/CODE&gt;&lt;CODE&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;I&amp;nbsp;have never seen any evidence for the belief that that multiple exit points pose a coding risk, or are bad style. I do not know of any formal study that has found this to be the case, on C# code or on code in any other language. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Coding horror recently talked about "&lt;A class="" href="http://www.codinghorror.com/blog/archives/001148.html"&gt;Spartan programming&lt;/A&gt;", and mentioned "frugal use of control structures, with early return whenever possible." &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN&gt;&lt;FONT face="Times New Roman" size=3&gt;One of the few links on the topic that I could find was "Return statements and the single exit fantasy":&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;A class="" href="http://www.leepoint.net/JavaBasics/methods/method-commentary/methcom-30-multiple-return.html"&gt;http://www.leepoint.net/JavaBasics/methods/method-commentary/methcom-30-multiple-return.html&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Take a look at some of the comments on the Daily WTF (&lt;A class="" href="http://thedailywtf.com/Articles/Refactoring_to_the_Max.aspx"&gt;http://thedailywtf.com/Articles/Refactoring_to_the_Max.aspx&lt;/A&gt; ) where this issue is raised, particularly this one:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Re: Refactoring to the Max&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;2006-04-05 02:25 • by John Hensley&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;SPAN&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;The main reason for the single return "law" in C is to make sure you &lt;/FONT&gt;&lt;FONT face="Times New Roman" size=3&gt;clean up memory, locks, handles, etc. before you leave a function.&lt;/FONT&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;This, on the other hand, is Java code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Apparently the reason for this "law" was that when coding in C or the like, it was natural to deallocate resources near the end of the function. Thus any extra exit points were an invitation to memory leaks. There are two reasons why this is no longer the case:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;B&gt;Firstly&lt;/B&gt;, garbage collected languages make explicit deallocation unnecessary in most cases.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;B&gt;Secondly&lt;/B&gt;, &lt;/FONT&gt;&lt;CODE&gt;&lt;SPAN style="FONT-SIZE:10pt;"&gt;try...finally&lt;/SPAN&gt;&lt;/CODE&gt;&lt;FONT face="Times New Roman" size=3&gt; blocks and &lt;/FONT&gt;&lt;CODE&gt;&lt;SPAN style="FONT-SIZE:10pt;"&gt;using&lt;/SPAN&gt;&lt;/CODE&gt;&lt;FONT face="Times New Roman" size=3&gt; statements allow deallocation to happen with greater certainly at the end of any block of code when it is needed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;BR&gt;&lt;FONT face="Times New Roman" size=3&gt;In any event, a function with multiple exit points is a far lesser issue than a &lt;A class="" href="http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html"&gt;goto&lt;/A&gt;.&amp;nbsp;In some cases it is the simplest way to code now that we have control structures to deal with it.&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Times New Roman" size=3&gt;But beware of returns in the middle of loops or highly nested code. All other things being equal, avoid them,&amp;nbsp;since they are&amp;nbsp;less readable and predictable. &lt;BR&gt;&lt;BR&gt;It is absolutely fine to use it as a first check on the parameters after entering a function, before getting down to the serious work and allocating those resources,– it's more readable than embedding the rest of the function in an if-block. However throwing an exception is the more usual case for this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;My view of the matter is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;UL style="MARGIN-TOP:0cm;"&gt;
&lt;LI class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;There are cases where a single return is more readable, and cases where it isn't. See if it reduces the number of lines of code, makes the logic clearer or makes the control structures less deeply nested.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;More than one return style may be a bad habit in C code, but there is no evidence for it being bad in more modern languages.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;There is no law requiring only one exit point for a method. Some people have an unsubstantiated belief in the superiority of this style.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Requiring fewer return statements for purposes of centralising resource deallocation is not a common need in modern languages that have garbage collection and &lt;/FONT&gt;&lt;CODE&gt;&lt;SPAN style="FONT-SIZE:10pt;"&gt;try..finally&lt;/SPAN&gt;&lt;/CODE&gt;&lt;FONT face="Times New Roman" size=3&gt; blocks.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Therefore, use as many returns as suits your artistic sensibilities, because it is a layout and readability issue, not a technical one.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;There's another issue at play here, about rules being adhered to without people grasping the reason why they are adhering to them, and thus keeping the rule in force after the need for it has evaporated. Rules should be given along with reasons for them.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Addendum:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Watching the DailyWTF commentators (who have a fairly high opinion of their own coding skills, given that they are essentially gathered there to point and laugh) try and repeatedly fail to translate the following code into a single expression underscores that the multiple-exit points version can be in some cases easier to understand, read, and modify: &lt;/FONT&gt;&lt;/P&gt;&lt;PRE style="MARGIN-LEFT:36pt;"&gt;&lt;PRE style="MARGIN-LEFT:36pt;"&gt;&lt;CODE&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;if (condition1(x)) &lt;BR&gt;&amp;nbsp; return true;&lt;BR&gt;if (condition2(x)) &lt;BR&gt;&amp;nbsp; return false;&lt;BR&gt;if (condition3(x)) &lt;BR&gt;&amp;nbsp; return true;&lt;BR&gt;return false;&lt;BR&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/PRE&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face="Times New Roman" size=3&gt;You'd think that this is the same as &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;CODE&gt;&lt;SPAN style="FONT-SIZE:10pt;"&gt;return condition1(x) || !condition2(x) || condition3(x);&lt;/SPAN&gt;&lt;/CODE&gt;&lt;FONT face="Times New Roman" size=3&gt;, &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;However the one-liner version returns true if all conditions are false, unlike the original. Furthermore, it evaluates condition3 if condition2 is true, which the original does not. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;You could also code it as:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;o:p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool result = false;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;if (condition1(x)) &lt;BR&gt;&amp;nbsp; result = true;&lt;BR&gt;if (condition2(x)) &lt;BR&gt;&amp;nbsp; result = false;&lt;BR&gt;if (condition3(x)) &lt;BR&gt;&amp;nbsp; result = true;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;return result;&lt;BR&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;/FONT&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;FONT face="Times New Roman" size=3&gt;However this also evaluates condition3 if condition2 is true, which the original does not. I'm sure that the original logic &lt;I&gt;can&lt;/I&gt; be replicated with only one return, but it's not going to be as elegant.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;&lt;o:p&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;Update: Richard Tobin has sent me this comment by email:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;This discussion is a common one that we continually face where I work.&amp;nbsp; I took your example and reworked it into a single return as follows:&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:'Tahoma','sans-serif';"&gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;LINE-HEIGHT:115%;FONT-FAMILY:'Lucida Console';mso-bidi-font-family:Tahoma;"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:'Lucida Console';mso-bidi-font-family:Tahoma;"&gt; &lt;SPAN style="COLOR:blue;"&gt;bool&lt;/SPAN&gt; LotsOfReturns(&lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; x)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR:blue;"&gt;if&lt;/SPAN&gt; (Condition1(x))&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/SPAN&gt; (Condition2(x))&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;false&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/SPAN&gt; (Condition3(x))&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;true&lt;/SPAN&gt;;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;false&lt;/SPAN&gt;;&lt;BR&gt;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;bool&lt;/SPAN&gt; OneReturn(&lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; x)&lt;BR&gt;{&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool&lt;/SPAN&gt; flag = Condition1(x);&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/SPAN&gt; (!flag)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&lt;/SPAN&gt; (!Condition2(x))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag = Condition3(x);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/SPAN&gt; flag;&lt;BR&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:'Tahoma','sans-serif';"&gt;&amp;nbsp;&lt;BR&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;After compiling and looking at the IL with Reflector, the single return routine seemed more compact and efficient, and the C# source seems less tricky.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&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;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;All I can really say is that he has suceeded in converting the code, and which one "seems less tricky" is going to be a matter of taste.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&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:0cm 0cm 10pt;"&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:0cm 0cm 0pt;"&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=11833" width="1" height="1"&gt;</description><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code/default.aspx">code</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/technical/default.aspx">technical</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+standards/default.aspx">code standards</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+review/default.aspx">code review</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/nitpicking/default.aspx">nitpicking</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/rule/default.aspx">rule</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/law/default.aspx">law</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/return/default.aspx">return</category></item><item><title>IDesign C# Coding standards</title><link>http://consultingblogs.emc.com/anthonysteele/archive/2007/10/12/IDesign-C_2300_-Coding-standards.aspx</link><pubDate>Fri, 12 Oct 2007 15:35:00 GMT</pubDate><guid isPermaLink="false">e847c0e7-38d9-45c0-b593-56747303e088:8790</guid><dc:creator>Anthony.Steele</dc:creator><slash:comments>2</slash:comments><comments>http://consultingblogs.emc.com/anthonysteele/comments/8790.aspx</comments><wfw:commentRss>http://consultingblogs.emc.com/anthonysteele/commentrss.aspx?PostID=8790</wfw:commentRss><description>&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;em&gt;&lt;span style="font-size:14pt;"&gt;&lt;font face="Times New Roman"&gt;De gustibus non est disputandum.&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&lt;font face="Times New Roman"&gt;&lt;span&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;font size="3"&gt;A Latin proverb, roughly &amp;quot;don&amp;#39;t argue about matters of taste&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;text-indent:-18pt;tab-stops:list 36.0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;As Scott Guthrie noted &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/10/08/october-8th-links-asp-net-asp-net-ajax-silverlight-and-net.aspx"&gt;here&lt;/a&gt;:, &lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;Juval Lowry has published his C# code layout standards here: &lt;a href="http://idesign.net/idesign/download/IDesign%20CSharp%20Coding%20Standard.zip"&gt;IDesign C# Coding standards&lt;/a&gt;&lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;This compliments the classic: &lt;/font&gt;&lt;a href="http://blogs.conchango.com/controlpanel/blogs/www.tiobe.com/standards/gemrcsharpcs.pdf"&gt;&lt;span style="color:windowtext;text-decoration:none;text-underline:none;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://www.tiobe.com/standards/gemrcsharpcs.pdf"&gt;www.tiobe.com/&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="http://www.tiobe.com/standards/gemrcsharpcs.pdf"&gt;www.tiobe.com/&lt;/a&gt;&lt;a href="http://www.tiobe.com/standards/gemrcsharpcs.pdf"&gt;www.tiobe.com/&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt;standards/gemrcsharpcs.pdf&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Low-level Code standards are wonderful things for your emotions&amp;ndash; you can agree fervently with 90% of one, and recoil in disgust at the last 10%. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;I&lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&amp;#39;m going through Juval Lowry&amp;#39;s document, and comment on the bits that I disagree with &lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;or want to explicate, and try to give reasons why I disagree. I&amp;#39;ll try to be mindful that arguing that &amp;quot;It looks bad to me&amp;quot; is not a valid reason &amp;ndash; what looks right to you is just what you&amp;#39;re used to.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 9a&lt;/strong&gt;: &amp;quot;avoid single character variable names&amp;quot; as noted somewhere in Code Complete, the comprehensibility of a short variable name is dependant on how wide its scope is. If the variable is referenced throughout the application, give it a long descriptive name. If it is used only over 2-3 lines of private code, a short or general name will suffice, and anyone can read a variable called &amp;quot;i&amp;quot; over this scope.. However, &amp;quot;loopIndex&amp;quot; is a short enough, general enough name for me to write.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 11&lt;/strong&gt;: use capital letters for types. I find &lt;/font&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;class MyDictionary&amp;lt;Key, Value&amp;gt;&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt; more readable than class &lt;/font&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;MyDictionary&amp;lt;K, V&amp;gt;&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt; , and it&amp;#39;s more in keeping with point 9. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 14&lt;/strong&gt;: Put using statments outside the namespace. Howard van Rooijen pointed out to me that putting the &amp;quot;using&amp;quot; inside the namespace means that it applies to the end of the namespace, not the end of the file, and this is generally what you intend, so there is a case to be made that the &amp;quot;using&amp;quot; goes inside the namespace. I&amp;#39;m not entirely convinced: if this distinction is meaningful to you because you have multiple namespaces in the file, one after the other, then you&amp;#39;re doing it wrong. Very wrong. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 20&lt;/strong&gt;: Preface private members with &amp;quot;&lt;em&gt;m_&lt;/em&gt;&amp;quot;. I&lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;s this looking Hungarian? Maybe, but it may be better than the alternatives. Various other conventions on this are in use. Starting with an underscore is not CLS compliant in cases where the var becomes protected and could be called from VB.NET code. &lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;I dislike using no prefix at all, just lower case, since it ends up in constructors like this:&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;class Foo&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private int bar;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;public Foo(int bar)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;this.bar = bar;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 36pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Which is just an accident waiting to happen in the constructor &amp;ndash; two identically named variables are in scope, and the use of &amp;quot;this.&amp;quot; To distinguish between them is not optional.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 24&lt;/strong&gt;: Open curly braces on new line: There is an exception for the simplest of properties,&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;I.e.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;public int foo&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;get { return m_foo; }&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;set { m_foo = value; }&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;More complex properties should not do this.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 25-26 -27&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Now we are getting into real matters of taste. See the way that the code on trailing lines lines up with the right-hand of the equals stuff? I don&amp;#39;t like that. I prefer to always indent trailing lines by one indentation stop (typically four spaces).&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;E.g. Not&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;int someReturnValue = CallAFunction(param1, param2,&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;param3, param4);&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;But&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;int someReturnValue = CallAFunction(param1, param2,&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;param3, param4);&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Despite taste, there are advantages of this layout:&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Indentation of the trailing line is consistent with other indented lines.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Indentation does not depend of the contents of the line above.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Indentation does not need to change if the line above changes, e.g. renaming the var.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Indentation is less, and thus there is more room on the line &amp;ndash; the code is more readable as it&amp;#39;s not all squashed up on the right.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Section 2&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 12-13&lt;/strong&gt; Bill Wagner explained the difference between readonly and const &amp;ndash; (Effective C#, Bill Wagner, Item 2) &amp;ndash; essentially const is folded in at compile-time, readonly values can be updated by updating the assembly that contains it.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 26&lt;/strong&gt; Avoid explicit values for enums. Why not give values to enums? I would, when they have to be explicitly the same as ints stored on a database. Also if you don&amp;#39;t specify values, the first one will be zero. Zero is best reserved for an &amp;quot;unknown&amp;quot;/&amp;quot;not set&amp;quot; value. (Bill Wagner - item 8). By saying &amp;quot;except when they are integer&amp;nbsp;powers of 2&amp;quot; does not encourage the reader to be mindful that enums in C# (and C) play two slightly different roles - select one from a named, restricted set of values, and to provide a set of flags over those values (this is when the numbers must correspond to the powers of 2).&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 55&lt;/strong&gt; &amp;ndash; Why prefer &lt;/font&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;String.Empty&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt; over &lt;/font&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt;? I had to find out why this one is correct. Because it doesn&amp;#39;t create a new string instance each time. Apparently it&amp;#39;s a trivial difference, but a difference nonetheless.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://blogs.msdn.com/brada/archive/2003/04/22/49997.aspx"&gt;http://blogs.msdn.com/brada/archive/2003/04/22/49997.aspx&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Point 56&lt;/strong&gt; &amp;ndash; When is StringBuilder faster than concatenation?&lt;span&gt;&amp;nbsp; &lt;/span&gt;If there&amp;#39;s a loop over lots of strings it is faster, but not if just concatenating three or four strings. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://www.heikniemi.net/hc/archives/000124.html"&gt;http://www.heikniemi.net/hc/archives/000124.html&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://www.chinhdo.com/chinh/blog/20070224/stringbuilder-is-not-always-faster/"&gt;http://www.chinhdo.com/chinh/blog/20070224/stringbuilder-is-not-always-faster/&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://www.chinhdo.com/chinh/blog/20070929/stringbuilder-part-2/"&gt;http://www.chinhdo.com/chinh/blog/20070929/stringbuilder-part-2/&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=8790" width="1" height="1"&gt;</description><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/dotNet/default.aspx">dotNet</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code/default.aspx">code</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+standards/default.aspx">code standards</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+review/default.aspx">code review</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/style/default.aspx">style</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/nitpicking/default.aspx">nitpicking</category></item><item><title>Code Review</title><link>http://consultingblogs.emc.com/anthonysteele/archive/2007/07/27/Code-review.aspx</link><pubDate>Fri, 27 Jul 2007 12:43:00 GMT</pubDate><guid isPermaLink="false">e847c0e7-38d9-45c0-b593-56747303e088:7845</guid><dc:creator>Anthony.Steele</dc:creator><slash:comments>0</slash:comments><comments>http://consultingblogs.emc.com/anthonysteele/comments/7845.aspx</comments><wfw:commentRss>http://consultingblogs.emc.com/anthonysteele/commentrss.aspx?PostID=7845</wfw:commentRss><description>&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;quot;Code review&amp;quot; is one of those topics where it sometimes seems that everyone means something slightly different by the phrase, yet everyone assumes that others understand exactly the same thing as themselves. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Code review in the broadest sense just means reading code; inspecting code critical eye; usually code written by someone else at an earlier date.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The greatest benefit is that bugs are found early. Another benefit is that coders can learn from other&amp;#39;s examples. And that common standards and idioms are propagated.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;a href="http://en.wikipedia.org/wiki/Code_review"&gt;Wikipedia defines code review&lt;/a&gt; as &amp;quot;Code review is systematic examination of computer source code intended to find and fix mistakes overlooked in the initial development phase, improving overall quality of software and can also be used as a tool to better develop skills at the same time.&amp;quot; &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Some degree of code review is cost-effective, but there must be a limit to that somewhere. The Extreme stance is that continuous pairing is cost-effective; but nobody is suggesting that we&amp;#39;d get software quality cheaper and faster by having ten full-time reviewers for each person engaged in coding. So, there are natural limits, but some code review is good. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Code review deals with the basics of software. I seem to have an interest in getting the basics right - it&amp;#39;s not SOA architecture design, but&amp;nbsp;I think it&amp;#39;s important to get the basics right even then.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Types of code review:&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;I&amp;#39;ll try and list some types of code review that i can think of, to make discussion easier:&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;br /&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Self review:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Reading your own code prior to check in is in my opinion a good practice, especially if done with the source control system&amp;#39;s diff tool in order to see what you have changed.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Informal peer review&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;e.g. &amp;quot;Hey Pete, can you have a look at this code before I check it in&amp;quot;. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Pairing:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Reviewing the code as it is being written. This is slightly different to regular code review, since one of the points of &amp;quot;review&amp;quot; is to see if the finished product makes sense, without seeing how it got like that. Also note that wikipedia&amp;#39;s definition of review includes &amp;quot;overlooked in the initial development phase&amp;quot; &amp;ndash; if it&amp;#39;s during the initial development phase, it&amp;#39;s not review, it&amp;#39;s just view.&lt;span&gt;&amp;nbsp; &lt;/span&gt;I&amp;#39;m not saying that pairing is bad, just that it does not quite fit the definition of code review.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Round-robin peer review:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Each person on the team reviews one other person&amp;#39;s code.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Group peer review.&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;A piece of code is selected, and all members read it and comment. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Senior review: &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;A team lead looks at the code of all other people on the team.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Automated review: &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Fxcop and the like can highlight lines of code worthy of more scrutiny.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Repository review: &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Inspecting the source control repository to see what has been checked in. This is more common on open-source projects where many people can check code in.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Patch management: &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;A more extreme version of repository review where changes are submitted as a patch to someone who is willing to review it and who has permission to check into the repository. In extreme cases, e.g. on the Linux kernel, there are multiple layers of review. The person who first reviews and accept the patch does not have access to the core repository, but must then pass it up the chain after acting as a quality filter, either accepting, rejecting or reworking submitted code.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Other parameters&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Feedback can be: verbally in a meeting, via email, wiki or comments in the code, via the source control system (e.g. TFS policy).&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Formality can be low, with an informal eye cast on the code, or formal with a meeting scheduled and minutes taken.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Mandatory review: &lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;TFS can be set up to force all changes to be reviewed by another party before being approved. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Issues document:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;This is a wiki page or the like where issues are recorded for later refactoring. I have seen it called a &amp;quot;code review document&amp;quot; but&amp;nbsp;I don&amp;#39;t see it as such.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Problems: Writing down an issue gives a feeling that &amp;quot;something is being done&amp;quot; but serves to delay actual action. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;It is harder to separate bugs from todos, which are not within the scope of code reviews. &lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Keeping a list of todos and issues to large to tackle immediately may well be a good idea, but I don&amp;#39;t think it fits the definition of code review.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Code review checklist:&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;A list of items, some possibly found in previous code reviews, to look out for in further code reviews. Items can be anything from general standard and policy down to specific errors to avoid.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;My experience&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Group peer review has worked well for me on a past project. The procedure was this: early in the week a file of code would be selected &amp;ndash; selected because it was important to review &amp;ndash; e.g. critical infrastructure, or it was the most complex example of it&amp;#39;s kind; or a typical example of it&amp;#39;s kind, or the first example in a new area of code.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;We would print out the code with line numbers, and scribble on it with marker pens and pencils.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;On Friday afternoon we went into a meeting room and worked from the top, commenting on everything. &lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;Any issues that repeatedly came up were fed into the code review checklist.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It&amp;#39;s as much about learning from the code as it is about spotting errors in the code. Though a surprisingly large number of potential sources of error were spotted.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Also a common coding style rapidly came out, which aided readability. After a while we were rapidly moving past things that were old hat &amp;ndash; either recorded in the review document or that we agreed to disagree on.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;I suppose that this could be done at less cost by not being so formal &amp;ndash; not booking a meeting room and all that, but the very formality and rhythm of it helped ensure that it kept going for quite a while.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;Like many agile practices, it both supports and depends on the people - if your team is fractured, this won&amp;#39;t fix it, but make it more visible.&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;So, what is your experience of code review?&lt;/font&gt;&lt;/p&gt;&lt;img src="http://consultingblogs.emc.com/aggbug.aspx?PostID=7845" width="1" height="1"&gt;</description><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/FxCop/default.aspx">FxCop</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code/default.aspx">code</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/review/default.aspx">review</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/technical/default.aspx">technical</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+standards/default.aspx">code standards</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/tools/default.aspx">tools</category><category domain="http://consultingblogs.emc.com/anthonysteele/archive/tags/code+review/default.aspx">code review</category></item></channel></rss>