Iris Classon
Iris Classon - In Love with Code

Stupid Question 101: Are there any coding standards documents for Net?

[To celebrate my first year of programming I will ask a ‘stupid’ questions daily on my blog for a year, to make sure I learn at least 365 new things during my second year as a developer]

Recommendations, standards or rules to live by?

It does seem to me like most programmers follow a similar naming convention when working on the .Net platform, and when it comes to design- we do seem to agree (most of the time) on a higher level on at least a few things. But are there any coding standards documents most developers follow? Or do just continue doing what we have been taught by others forming our own standards based on what makes sense to us and the experiences we’ve had?

It probably is a combination- for me at least it is.

As for the question, are there any coding standards docuements for .Net? There are and they can be found underDesign Guidelines for Developing Class Libraries

It covers things such as:

  • Guidelines for Names

  • Type Design Guidelines

  • Member Design Guidelines

  • Designing for Extensibility

  • Design Guidelines for Exceptions

  • Usage Guidelines

And on a separate page covers asynchronous programming

Of course these are not the only coding standards documents that exist, but it does seem to be the recommended start for most developers. On Stackoverflow a user asked:
Are there any suggestions for developing a C# coding standards / best practices document? - and the Design Guidelines for Developing Class Libraries was recommended, as well as not trying to come up with your own coding standards. If you have some extra time I would recommend reading the replies as its a good read :)

Next question will be about StyleCop


Leave a comment (via email)
Lars Wilhelmsen
12/13/2012 12:03:55 AM

Is really the only book you'll need in your bookshelf regarding the topic :)

Iris Classon
12/13/2012 12:11:53 AM
Reply to: Lars Wilhelmsen
Thank you, that is excellent advice! I'll see if I can get a hold of a copy and review it :) 
Michael Lund (@iCodeIT_dk)
12/13/2012 1:11:06 AM
I concur - The Framework Design Guidelines book is the bible on the matter.

Emil Åström
12/13/2012 1:25:03 AM
This is also pretty widely used:

"The IDesign C# Coding Standard, development guidelines, and best practices"

Mark Carr
12/13/2012 3:14:20 AM
Reply to: Iris Classon
It's definitely worth taking a look at. From the back cover: "...the only definitive source of best practices for managed code API development, direct from the architects themselves". 
Mark Carr
12/13/2012 3:49:12 AM
Further to the last, 'Code Complete' by Steve McConnell is also a gem of a programming book. 
Sean Kearon
12/13/2012 5:39:39 AM
Yes - you gotta love the Framework Design Guidelines.  Quite possibly the best .NET book there ever written! 
Sean Kearon
12/13/2012 7:23:52 AM
Reply to: Mark Carr
Very true.  Should be required reading for any developer!  Rapid Development, also from Steve McConnell is also very worth reading - very eye opening stuff. 
Phil Bolduc
12/13/2012 8:36:56 AM
StyleCop -

Works great with JetBrains ReSharper 

Last modified on 2012-12-11