I'm a recent AI graduate (circa 2 years) working for a modest operation. It has fallen to me (primarily as I'm the first 'adopter' in the department) to create a basic (read useful?) C# coding standards document.
I think I should explain that I'm probably the most junior software engineer going, but I'm looking forward to this task as hopefully I might actually be able to produce something half usable. I've done a pretty extensive search of the Internet and read articles on what a coding standards document should / should not contain. This seems like a good as place as any to ask for some suggestions.
I realise that I am potentially opening a door to a whole world of disagreement about 'the best way to do things'. I both understand and respect the undeniable fact that each programmer has a preferred method of solving each individual task, as a result I'm not looking to write anything so draconianly proscriptive as to stifle personal flair but to try and get a general methodology and agreed standards (e.g. naming conventions) to help make individuals code more readable.
So here goes .... any suggestions? Any at all?
In the code I write I usually follow .NET Framework Design Guidelines for publicly exposed APIs and Mono Coding Guidelines for private member casing and indentation. Mono is an open source implementation of .NET, and I think those guys know their business.
I hate how Microsoft code wastes space:
What you might find strange in Mono guidelines, is that they use 8-space tabs. However, after some practice, I found that it actually helps me writing less tangled code by enforcing a kind of indentation limit.
I also love how they put a space before opening parenthesis.
But please, don't enforce anything like that if your coworkers dislike it (unless you are willing to contribute to Mono ;-)
I've used Juval's before and that's through if not overkill, but I'm lazy and now just conform to the will of Resharper.
I found the following documentation very helpful and concise. It comes from the idesign.net site and it is authored by Juval Lowy
C# Coding Standard
NB: the above link is now dead. To get the .zip file you need to give them your email address (but they won't use it for marketing... honestly) Try here
I've just started at a place where the coding standards mandate the use of m_ for member variables, p_ for parameters and prefixes for types, such as 'str' for strings. So, you might have something like this in the body of a method:
m_strName = p_strName;
Horrible. Really horrible.
Our entire coding standard reads roughly, "Use StyleCop."
I have to suggest the dotnetspider.com document.
It is a great and detailed document that is useful anywhere.