Zac Gery thinks when it comes to coding standards:

in most circumstances the unrecognized pitfalls outweigh the benefits

I strongly disagree! But lets go through his points one by one:

Some team members equate coding standards to a lack of confidence in his/her abilities. Others find standards such as spacing and/or comments to be micro-managing.

Pardon me? If you have team members that have an issue adhering to simple team rules like "we want our {s on a separate line" and consider that a personal insult you have some serious issue in your team. Software development is a team effort. If you are working in a team you have to adhere to the rules of the team, no matter if they are written down or exist as implicit knowledge of the team.

Coding standards stifle and discourage coding creativity. Some of the best code comes from an unfiltered mind.
They create unneeded stress within a team as members disagree with various standards. These discussions can spiral into negative, unproductive debates.

Hands up: Who considers it an important part of their creativity to decide on every line how far to indent it? That's what I thought. Discussions about coding standards? Yup, we have those too. But there is no spiral involved. Somebody brings up a concern like "I think we should stop prefixing field access with this." We exchange arguments and opinions. Then we decide. End of debate. Again, if you have constant fights in your team about this kind of thing, you have a serious problem in your team and its not the code style guide.

Each new rule adds to the overall complexity of implementation, enforcement, and maintenance of coding standards.

99% of all coding standards get implemented and maintained by your code formatter. The stuff that doesn't gets enforced by tools like checkstyle. Therefor there really isn't any relevant effort involved. Coding standards reduce these efforts because it prevents formatting wars and reduces the time needed for reading code.

Each concession to a rule devalues the overall purpose of coding standards.

That's like saying we should legalize murder since every killing devalues the laws against it. Doesn't make any sense.

Coding standards distract from the larger goal of building, testing, and releasing functionality in a timely manner.

I still don't get it. How is it less distracting, when I have to check if a token references a class or a field just by checking if it starts with an upper case character? How is it less distracting, when I have to search for matching curly braces because the code is not properly indented?

Deciding how to handle existing code that pre-dates the creation of a standard is a winless battle.

Again, why battle? Have a discussion, make a decision, be done with it. Get used to it, this is an important part of working in a team.

When a coding standard is not followed, what happens to that code? Must it be fixed immediately? How does that effect its testing, retesting, or release time lines? Some consider this code to be technical debt. That is a difficult label to apply to code if the violations are simply style related.

Since coding standards should be trivial to follow they should break your build and get fixed. If you or team members have a problem with that: Have a discussion, make a decision, be done with it. What is the problem with the label technical debt? Violation of coding standards make it harder to read that code. That is the interest rate you pay for that debt until you pay it back. Fits perfectly. Of course how large that debt is when a single { is misplaced is a different question. But then again, paying that back should be as simple as opening the file and pressing a shortcut.

Proper enforcement of coding standards can consume an unreasonable amount of time.
The decision to enforce coding standards and its consequences must be embraced at all levels within a company. Most companies struggle to embrace doing something twice.

Why is enforcing rules "doing something twice"? Don't understand that. For the first sentence. Of course you can come up with coding standards that are hard to enforce. Just don't. Use standards that play well with your tool setting. Automate it. And think again if your coding standard has to be company wide. This works well for small companies, but results in coding standards 1000 pages thick and completely useless. I have seen those. That shouldn't keep you from having coding standards for your team.

Zac continues to recommend code reviews. A good thing! But not a replacement for coding standards.

You absolutely should have coding standards in any team consisting of two or more developers. Part of deciding on the standards to use should be the way to enforce them and this should be largely automatic.

Even more important than coding standards is a team standard on how to make decisions. If that standard fails in the trivial case of coming up with coding standards you have a serious problem.

And don't go for compromises when it comes to coding standards (by Geek&Poke)
coding standard compromise by Geek & Poke


Wan't to meet me in person to tell me how stupid I am? You can find me at the following events: