Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing and Enforcing Coding Standards [closed]

My team (of which I am the newest and most junior member) has increased in size from 3 to 9 developers in just about 1 year. Our primary product has increased in complexity and we are about to undertake a year long port/re-write to Silverlight. In the past there has been no specific style/standard enforced.

I suggested to my boss that now would be a good time to implement such standards. I passed on IDesign's document to him and he likes the idea. He has 2 concerns.

  1. This is a big document to absorb. My thought here is to develop a slimmed down cheat-sheet for the most common items that we're likely to run into, with the understanding that the IDesign standard is the "Master" and anything not covered in the slimmed down version should be looked up in the "Master" document.

  2. What is the best way to enforce this. It's not a question of trying to dictate; it's a matter of trying to get folks used to developing to a particular standard. There are at least 2 folks on the team that have been developing to the current non-standard for several years now. In order to address this concern, I'd like to see if there's a tool that can be configured to enforce these standards, or at a minimum warn of "violations" of the standard at either compile-time or design-time. I found Microsoft'd StyleCop, but from what I've been able to determine, it isn't configurable and is set up to follow Microsoft's standard, which doesn't completely mesh with IDesign's.

Any input on tools or the approach I'm looking at would be appreciated.

like image 667
Steve Brouillard Avatar asked Dec 04 '08 20:12

Steve Brouillard


People also ask

How do you enforce good coding standards?

Code standards enforced by automated rule checks improve the readability and maintainability of code—as well as reduce the number of bugs. Set standards help programmers and teams establish self-improvement routines and healthy habits to follow.

Why a coding standard is necessary for implementation?

Coding standards are vital as it ensures the safety, reliability, and security of your outsourced project. Your outsourced development team should use coding standards to avoid errors that may lead into performance glitches. As a worst case scenario, it could cause a serious security breach.

How do you enforce code style in a project?

Use an EditorConfig file when you want to enforce coding styles for all contributors to your repo or project. You can manually populate your EditorConfig file, or you can automatically generate the file based on the code style settings you've chosen in the Visual Studio Options dialog box.


2 Answers

A combination of ReSharper, FxCop/StyleCop (there is a way to define custom rules at least for FxCop), clear code guidelines and monthly reviews should do the job for a team of nine people I think. If someone breaks the rules, you'll have no way but to use a whip :)

like image 154
Florian Greinacher Avatar answered Nov 15 '22 20:11

Florian Greinacher


Regular code reviews would be a good way to go...

I've found developers respond better to face-to-face discussions about a particular standard rather than leaving it solely to a tool.

Using a tool together with code reviews should be good.

like image 32
Joe Ratzer Avatar answered Nov 15 '22 20:11

Joe Ratzer