Are there any suggestions for developing a C# codi

2019-01-03 11:33发布

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?

26条回答
我命由我不由天
2楼-- · 2019-01-03 11:49

As I wrote both the one published for Philips Medical Systems and the one on http://csharpguidelines.codeplex.com I might be a bit biased, but I have more than 10 years on writing, maintaing and the promotion of coding standards. I've tried to write the one CodePlex with differences in opinions in mind and spent the majority of the introduction on how to deal with that in your particular organisation. Read it and provide me with feedback.....

查看更多
闹够了就滚
3楼-- · 2019-01-03 11:49

I'm a big fan of the Francesco Balena book "Practical Guidelines and Best Practices for VB and C# Developers".

It's very detailed and covers all the essential topics, It doesn't just give you the rule, but also explains the reason behind the rule, and even provides an anti-rule where there could be two opposing best practices. The only downside is that it was written for .NET 1.1 developers.

查看更多
欢心
5楼-- · 2019-01-03 11:54

I have always used Juval Lowy's pdf as a reference when doing coding standards / best practices internally. It follows very close to FxCop/Source Analysis, which is another invaluable tool to make sure that the standard is being followed. Between these tools and references, you should be able to come up with a nice standard that all your developers won't mind following and be able to enforce them.

查看更多
戒情不戒烟
6楼-- · 2019-01-03 11:54

You can check out this,Top 7 Coding Standards & Guideline Documents For C#/.NET Developers http://www.amazedsaint.com/2010/11/top-6-coding-standards-guideline.html hope this helps

查看更多
We Are One
7楼-- · 2019-01-03 11:54

I think I echo the other comments here that the MS guidlines already linked are an excellent starting point. I model my code largely on those.

Which is interesting because my manager has told me in the past that he is not too keen on them :D

You have a fun task ahead of you my friend. Best of luck, and please ask if you need anything more :)

查看更多
登录 后发表回答