Coding Standards document

Hi folks.

As a team lead I had to prepare a Coding Standards document.

I tried to find a template, but everything I found are very verbose and from my experience people rarely read such documents carefully.

So I’ve decided to build one from scratch. I wanted to provide examples of bad and good approaches whenever possible.

To keep the document short I’ve included my configuration file for ReSharper and did not include all zillions of the settings in the Coding Standards document, you can just import my settings and see them inside ReSharper settings window.

Here we are:

I am willing to hear your opinion, especially if my “best practices” are not the best really. Or if you believe I am missing some important ones.

Alternatively you can make pull requests.

P.S. I used to have one “best practice” idea (inherited from Alexey Samokhin): omit private modifiers for class members and internal modifier for non-nested classes. The reason for that is that are modifiers by default anyway, why would we need to specify them… And I’d been using this idea for more than 2 years and had it in my ReSharper configuration. However, recently one of my colleagues (Sergey Hurko) convinced me that this idea is actually makes code more difficult to read, because not all the developers knows these default modifiers by heart.

The list looks really scaring.

I know all these rules by heart and they seem to be obvious for me but with the tears in my eyes I did agree that this “best practice” should not be imposed

UPD: Addressing jonathanconway‘s comment… I did not specify anything about var rules in the document, because it is a part of the ReSharper Cleanup setting that I’ve created.


I tend to use var for non-trivial types, as I think it a little bit weird to write

var i = 42;
var s = "abc";

I’d prefer

int i = 42;
string s = "abc";

But again, that’s just a matter of preference anyway šŸ™‚


About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to Coding Standards document

  1. They look pretty good to me. Though the minimalist in me says, go a step further than using type aliases (e.g. ‘int’) and don’t even specify the type unless necessary (so use ‘var’ instead). I personally find it very rare that I have to declare the type upfront like that. But it might be just me.

  2. mnaoumov says:

    Jon, good point. That’s strange how our preferences change in a different context. For example, if I see egyptian brackets (aka KR style) in C# I feel like I am going to vommit. However I have the same feelings if I see BSD style brackets in JavaScript šŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s