Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

Coding Standards Are Overrated

, 2 Feb 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Code reviews help developers focus on larger concerns such as architectural issues and provide a forum to offer other coding suggestions. Performing intermittent code reviews covers the key aspects of coding standards while avoiding most of their pitfalls.
As a development team grows, so does its complexity. This complexity manifests itself in many areas including team member interactions, increased project administration, and evolving communication strategies. At some point in every team the question of coding standards is broached. Unfortunately, most teams agree to compile coding standards under the false pretenses of only their positive attributes. It's important to consider the unintended ramifications before introducing a new process. Start by defining what are "coding standards?" They are commonly a series of guidelines which include recommended programming style, practices, and other various aspects of developing. The most common benefits outlined are:
  • Coding standards encourage good coding habits.
  • Coding standards help prevent bugs in known problem areas such as memory issues.
  • Standards can be a helpful guide to junior developers.
  • Standardized coding makes more maintainable code.
  • Code is more legible through standardized formatting and comments.
All of the items mentioned above are excellent reasons to implement coding standards; unfortunately, in most circumstances the unrecognized pitfalls outweigh the benefits. The following section outlines these areas:
  • 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.
  • 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.
  • Each new rule adds to the overall complexity of implementation, enforcement, and maintenance of coding standards.
  • Each concession to a rule devalues the overall purpose of coding standards.
  • Coding standards distract from the larger goal of building, testing, and releasing functionality in a timely manner.
  • Deciding how to handle existing code that pre-dates the creation of a standard is a winless battle.
  • 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.
  • 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.
If coding standards are not the preferred approach, what is? Code reviews are an excellent replacement for coding standards. They can be completed at the preferred speed of each team. They are a positive teaching and discussion tool. As described in "Code Reviews: Understanding and Breaking the Stigma", they can be a great team building exercise by having different members participate. Speaking with another developer about coding has a human touch that a coding standards document lacks. Code reviews help developers focus on larger concerns such as architectural issues and provide a forum to offer other coding suggestions. Performing intermittent code reviews covers the key aspects of coding standards while avoiding most of their pitfalls.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Zac Gery

United States United States
Software Developer, Mentor, Architect and UX/UI craftsman. Also, a psychology nut that loves curling.
Follow on   Twitter   Google+

Comments and Discussions

 
QuestionMy vote of 4 Pinmembermac_v2-Feb-13 13:46 
GeneralMy vote of 1 PinmemberKinStephen2-Feb-13 12:26 
You suggest code reviews instead of coding standards as though it's one or the other. Both coding standards and code reviews can and should co-exist together.
 
Also to clarify you don't have a problem with this?
 
bool x = false;
// Lots of code in between.
if (x)
{
}
 
This is what coding standards are supposed to prevent. Code reviews would enforce these coding standards.
 
P.S. The coding standards cons you outline seem of your own personal opinion and not based on any real polling or metrics from the industry.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 2 Feb 2013
Article Copyright 2013 by Zac Gery
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid