<?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>OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx</link><description>We had a great chat today following up from the Designing .NET Class Libraries session on Naming Conventions . I believe we did get a transcript of that chat that will be posted soon. One of the things that was asked in one way or another about 50 times</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361416</link><pubDate>Thu, 27 Jan 2005 08:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361416</guid><dc:creator>James</dc:creator><description>The only thing there that I really disagree with is not prefixing private member variables with an underscore.&lt;br&gt;&lt;br&gt;Using a single underscore is much shorter and easier than using a (optional) this. prefix to differentiate between parameters and private variables in code and has the nice added benefit of grouping the private variables together, allowing for quick browsing using the intellisense dropdown.&lt;br&gt;&lt;br&gt;My 2c.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361439</link><pubDate>Thu, 27 Jan 2005 09:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361439</guid><dc:creator>Sam</dc:creator><description>But a single underscore in front is plain _ugly.&lt;br&gt;&lt;br&gt;(Oh, I am coming close to the CamelCase vs under_scores flamewar here, better be careful now*g*)&lt;br&gt;&lt;br&gt;I agree its good for reading to have all internal variables begin with the same prefix (recommended reading: John Lakos, 'large scale c++ programming'), but a single underscore is sometimes easily missed and, uhm, well, looks plain ugly to me :)&lt;br&gt;&lt;br&gt;Sam</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361446</link><pubDate>Thu, 27 Jan 2005 09:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361446</guid><dc:creator>James</dc:creator><description>I guess it is a little ugly but I find it preferable to having lots of this.'s throughout my code, bloating it unnecessarily, when a single character could do.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361449</link><pubDate>Thu, 27 Jan 2005 09:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361449</guid><dc:creator>Sam</dc:creator><description>And what do you think about adding a prefix like m_ instead of _ to the variable? It cant be as easily missed as the single underscore.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361502</link><pubDate>Thu, 27 Jan 2005 11:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361502</guid><dc:creator>RJ</dc:creator><description>Sam you are contradicting yourself.  Either an underscore is easy to miss or it is ugly.  </description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361534</link><pubDate>Thu, 27 Jan 2005 12:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361534</guid><dc:creator>Sam</dc:creator><description>RJ, You think so?&lt;br&gt;&lt;br&gt;When I read source from someone else (e.g. codeproject) I tend to miss leading underscores when they are used in compact source - when I see them, usually where they are defined, or at a closer look at the complex source (that made no sense without the closer look since I missed the leading underscore), then I see the underscore and it looks ugly to me.&lt;br&gt;&lt;br&gt;(btw, m_ also looks ugly to me, but it aint so easy to miss.)&lt;br&gt;&lt;br&gt;I see no connection between 'easy to miss' and 'ugly'. Something can be one, both, or naught of this.&lt;br&gt;&lt;br&gt;Maybe you can explain to me where the contradiction is?</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361551</link><pubDate>Thu, 27 Jan 2005 13:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361551</guid><dc:creator>Kevin Westhead</dc:creator><description>I still use m_ for unexposed instance-wide members and s_ for unexposed type-wide members since I feel it's important to see that kind of scope information in the code.&lt;br&gt;&lt;br&gt;e.g. the method call below might need to be reviewed given that the parameter is available across the entire instance, especially if the method body also references m_foo:&lt;br&gt;&lt;br&gt;  private Foo m_foo;&lt;br&gt;&lt;br&gt;  ...&lt;br&gt;&lt;br&gt;  Bar bar = GetBarFromFoo(m_foo);&lt;br&gt;&lt;br&gt;  ...&lt;br&gt;&lt;br&gt;  private Bar GetBarFromFoo(Foo foo) { ... }&lt;br&gt;&lt;br&gt;Tool support (i.e. VS .NET) also means I can type m_ &amp;lt;CTRL+SPACE&amp;gt; to easily see a list of all my instance members and s_ &amp;lt;CTRL+SPACE&amp;gt; to easily see all my type members.&lt;br&gt;&lt;br&gt;Obviously exposed members (public, protected or protected internal) follow the class library naming guidelines.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361573</link><pubDate>Thu, 27 Jan 2005 14:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361573</guid><dc:creator>G. Man</dc:creator><description>Brad,&lt;br&gt;&lt;br&gt;I was in the chat yesterday but did not get a chance to voice my question (had to leave). &lt;br&gt;&lt;br&gt;The single worst parameter name I have ever seen in my life is:&lt;br&gt;&lt;br&gt;Control.Dispose(bool disposing);&lt;br&gt;&lt;br&gt;Yuck!! What on earth does that parameter mean? DON'T answer the question - that's not the point. The point is there is NO way to fathom what on earth a &amp;quot;disposing&amp;quot; bool parameter means to a method called &amp;quot;dispose&amp;quot; without looking at the help. And of course I need to look at the help all the time cause I can't be sure remember correctly.&lt;br&gt;&lt;br&gt;Are you going to fix this ghastly atrocity somehow? Please say that you are.&lt;br&gt;</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361664</link><pubDate>Thu, 27 Jan 2005 16:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361664</guid><dc:creator>Jacques Troux</dc:creator><description>&amp;quot;this.&amp;quot; makes me want to cry. If your variable names are so bad that you need five redundant characters to indicate a member variable, you need to rename them. A leading &amp;quot;m_&amp;quot; is fine.&lt;br&gt; &lt;br&gt;And, like all religions, I'm right and you're going to hell. :P</description></item><item><title>RE: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361701</link><pubDate>Thu, 27 Jan 2005 17:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361701</guid><dc:creator>haacked@gmail.com (Haacked)</dc:creator><description>You're all wrong. All private members should be prefixed  with:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;thisVariableIsPrivate_&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;It has both the benefits of using &amp;amp;quot;this&amp;amp;quot; and _ and is very clear in the meaning.  Much more so than such arcane symbols as &amp;amp;quot;m_&amp;amp;quot; and &amp;amp;quot;_&amp;amp;quot;.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361760</link><pubDate>Thu, 27 Jan 2005 18:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361760</guid><dc:creator>Keith Patrick</dc:creator><description>Hey, cool!  Each of your spacing suggestions addresses a pet peeve of mine.  And all this time, I thought I was being stubborn with refusing to adopt some of the older C-style conventions.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361774</link><pubDate>Thu, 27 Jan 2005 18:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361774</guid><dc:creator>Haacked</dc:creator><description>You're all wrong. All private members should be prefixed with: thisVariableIsPrivate_ It has both the benefits of using &amp;quot;this&amp;quot; and _ and is very clear in the meaning. Much more so than such arcane symbols as &amp;quot;m_&amp;quot; and &amp;quot;_&amp;quot;.</description></item><item><title>Instance variable decorations</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#361875</link><pubDate>Thu, 27 Jan 2005 20:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:361875</guid><dc:creator>Keith Hill</dc:creator><description>Using some form of decoration on instance variables is beneficial in my opinion.  The problem with using this is that the compiler will compile up the resulting code just fine if you forget to apply &amp;quot;this.&amp;quot;.  Then the resulting code is harder to read because I can't easily disambiguate between local, instance and static variables.  We currently recommend using m_ for instance variables and s_ for static variables.  In this case, forgetting the &amp;quot;m_&amp;quot; later on doesnt' work because the code won't compile.  However I find myself starting to like the simpler &amp;quot;_&amp;quot; approach but then what do I do to know if a var is a static?  I am also starting to long to use the all caps naming convention for non-public constants e.g. private int BUFFER_SIZE;&lt;br&gt;</description></item><item><title>The .NET Celebrity Auction on EBay...</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362096</link><pubDate>Fri, 28 Jan 2005 05:22:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362096</guid><dc:creator>Brad Abrams </dc:creator><description /></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362173</link><pubDate>Fri, 28 Jan 2005 05:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362173</guid><dc:creator>Matt</dc:creator><description>Totally agree about the Dispose method's parameter name &amp;quot;disposing&amp;quot;. Surely &amp;quot;notFinalizing&amp;quot; or &amp;quot;isNotFinalizing&amp;quot; would have been easier to understand?&lt;br&gt;&lt;br&gt;It's a shame MS didn't follow their standards for their templates - the Form template clearly violates the guidelines for spacing.&lt;br&gt;&lt;br&gt;More annoying is the space that VS puts between the method name and the parenthesis when you overload a method: &amp;quot;base.Something ();&amp;quot;&lt;br&gt;&lt;br&gt;I think those last two points are fixed one way or another in Whidbey... although I still think &amp;quot;disposing&amp;quot; is a rotten name for the parameter.</description></item><item><title>MS Internal Coding Guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362246</link><pubDate>Fri, 28 Jan 2005 11:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362246</guid><dc:creator>Cook Computing</dc:creator><description>The Internal Coding Guidelines posted by Brad Abrams are very similar to the style I prefer. Perhaps the main difference is that I use an underscore prefix for member variables, although I've never been completely happy with this. It does...</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362464</link><pubDate>Fri, 28 Jan 2005 15:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362464</guid><dc:creator>Frank Hileman</dc:creator><description>I think the &amp;quot;lack of prefix for member variables&amp;quot; idea is being misunderstood. It is not that you use &amp;quot;this.&amp;quot; all the time as a replacement for &amp;quot;m_&amp;quot;. You only need to use &amp;quot;this.&amp;quot; when you run into the rare situation where a method parameter name matches the name of a member variable. In my experience, this only happens in constructors, because in property set methods the incoming value is always named &amp;quot;value&amp;quot;.&lt;br&gt;&lt;br&gt;So in practice the &amp;quot;lack of prefix&amp;quot; convention works just fine, and is not difficult to read. We use this convention.&lt;br&gt;&lt;br&gt;At first I found it hard to read, as I was used to the m_ prefix from C++. Later I realized it could only become a problem with constructors, and when looking at a single very long method extracted from a class. In the latter case, you do not have the class definition in front of you to define the member variables, and the length of the method means one may forget the names of the incoming parameters when browsing the depths.&lt;br&gt;&lt;br&gt;Even with this drawback, I now prefer no member prefix, as it is both easier on the eyes and the wrist.</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362504</link><pubDate>Fri, 28 Jan 2005 16:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362504</guid><dc:creator>Keith Hill</dc:creator><description>Matt, I totally agree on the protected Dispose bool parameter.  I should have been called something like disposedManaged.  &lt;br&gt;Frank, removing the prefixes for ivars is probably  something I could get used to. It is just so ingrained.  Although I do like the advantage of having all ivars grouped together in the Intellisense drop down list.  Of course, that could be accomplished without relying on lexigraphical sorts but MS would have to implement that support.</description></item><item><title>.NET Coding Guidlines used inside Microsoft</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362754</link><pubDate>Sat, 29 Jan 2005 01:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362754</guid><dc:creator>Just Ramblings...</dc:creator><description /></item><item><title>.NET Coding Guidlines used inside Microsoft</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362756</link><pubDate>Sat, 29 Jan 2005 01:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362756</guid><dc:creator>Just Ramblings...</dc:creator><description /></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362832</link><pubDate>Fri, 28 Jan 2005 23:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362832</guid><dc:creator>John Melville</dc:creator><description>I pefer non-prefixed class and local variables.  90% of the time the appropriate scope is obvious from the variables name.  For the remaining 10%, we have intellisense.&lt;br&gt;&lt;br&gt;    The point that is so often missed is that pronouncable code is readable code, even when reading silently.  (For a great read on how things so seemingly innocent as underlines and boldface can destroy the reading experience, I recommend Bill Hill's _The Magic of Reading_)&lt;br&gt;&lt;br&gt;     Code is read far more often than its written.  There has been a lot of research on what makes things easy to read, and professionals ought to at least consider what has come before.</description></item><item><title>.NET Coding Guidlines used inside Microsoft</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#362895</link><pubDate>Sat, 29 Jan 2005 04:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:362895</guid><dc:creator>Rocky Thoughts..</dc:creator><description /></item><item><title>C# coding and style guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#363049</link><pubDate>Sat, 29 Jan 2005 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363049</guid><dc:creator>.NET Addicted</dc:creator><description /></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#363441</link><pubDate>Sun, 30 Jan 2005 21:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363441</guid><dc:creator>Doug</dc:creator><description>I preferred &lt;a target="_new" href="http://www.tiobe.com/standards/gemrcsharpcs.pdf"&gt;http://www.tiobe.com/standards/gemrcsharpcs.pdf&lt;/a&gt;</description></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#363942</link><pubDate>Mon, 31 Jan 2005 18:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363942</guid><dc:creator>Joe Duffy</dc:creator><description>I agree entirely that 'protected void Dispose(bool disposing)' isn't a great method signature... for a number of reasons. IMHO, the primary problem is more to do with the name of the method itself.&lt;br&gt;&lt;br&gt;One could imagine a world where 'Dispose(bool)' is formalized as the &amp;quot;destructor&amp;quot; and had been given C#'s syntax (instead of Finalize), e.g. as in '~ClassName(bool)', or even just '~ClassName()' with a well-known predicate that enables the destructor to ask GC.AmIFinalizing? Then 'Finalize' and 'Dispose' both wire up to this either automatically by the runtime or in a very straightforward manner. Even without this design, a name like SharedCleanup, or something perhaps a bit nicer, would have made more sense. Bit I digress. :) Unfortunately, I think the ship has mostly sailed on this particular problem.&lt;br&gt;&lt;br&gt;Regarding the parameter name. Assuming we like Dispose for the method name (ugh), we really ought not to be asking &amp;quot;are we disposing,&amp;quot; but rather &amp;quot;are we finalizing?&amp;quot; In retrospect, a better signature might have been: Dispose(bool isFinalizing). This swaps the boolean meaning and thus isn't doable at this point. This leaves changing the name to something that preserves the boolean value. We could do something like isNotFinalizing or isDisposing, but it's not clear that this is much better. Especially considering that we've already shipped a whole slew of types using the disposing param name... Unfortunately, changing a parameter name is also a breaking change.&lt;br&gt;&lt;br&gt;So what is the conclusion? Nothing much. While not a perfectly designed pattern, the sheer number of already disposable types makes it difficult to do good on this one... And surely there are worse off designs in the Framework somewhere (API hall of shame)... Brad's been pretty good at point these out, both in his book and this blog... :)</description></item><item><title>re: C# Coding Guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#363944</link><pubDate>Mon, 31 Jan 2005 21:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363944</guid><dc:creator>Eric Gunnerson's C# Compendium</dc:creator><description /></item><item><title>re: OK, I give.  Here are a set of internal coding guidelines</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#363995</link><pubDate>Mon, 31 Jan 2005 19:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:363995</guid><dc:creator>Not using a prefix for field scope.</dc:creator><description>I personally liked hungarian, with its ability to encode a variables scope, and type. I understand with the move away from C/C++ a varaibles type is not as important. Not have any way to specify scope is more of an issue for me. Without any scopy indicator I have to question what the scope of a variable is, field, local, or param, wether I'm writing or reading a class method. &lt;br&gt;&lt;br&gt;Thats my two sense. For what its worth, most projects at ms, require us to NOT use any type of  scope prefix.&lt;br&gt;</description></item><item><title>Brad Abrams caved in...</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#711860</link><pubDate>Tue, 22 Aug 2006 10:23:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:711860</guid><dc:creator>Rudi Larno's WebLog</dc:creator><description>Since I'm getting started in a new team, these are the kind of documents I am digging up these days....</description></item><item><title> Brad Abrams OK I give Here are a set of internal coding guidelines | Green Tea Fat Burner</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#9741545</link><pubDate>Sat, 13 Jun 2009 06:02:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9741545</guid><dc:creator> Brad Abrams OK I give Here are a set of internal coding guidelines | Green Tea Fat Burner</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://greenteafatburner.info/story.php?id=1741"&gt;http://greenteafatburner.info/story.php?id=1741&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Brad Abrams OK I give Here are a set of internal coding guidelines | Outdoor Decor</title><link>http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx#9746084</link><pubDate>Sun, 14 Jun 2009 00:36:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9746084</guid><dc:creator> Brad Abrams OK I give Here are a set of internal coding guidelines | Outdoor Decor</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://outdoordecoration.info/story.php?id=302"&gt;http://outdoordecoration.info/story.php?id=302&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>