Why Coding Standards Are Important

  • 3 minutes to read
  • edit

Just as style is an often overlooked but very critical attribute of writing, coding standards are also an often overlooked but very critical attribute of software development.

Following a consistent coding standard helps improve the quality of the overall software system. The key to a good coding standard is consistency. This consistency needs to be found within the standard itself (in other words, you need to make sure that guidelines don’t contradict one another) but also within the source code that uses the standard. Completed source code should reflect a harmonized style, as if a single developer wrote the code in one session.

This usually leads to the argument that “writing sloppy code provides job security”. In a way, this is true. If you are the only one that can understand the code (both structurally and functionally) you will be the only one that can make changes and bug fixes to that code. This is what you want, right? That way, you will never be able to leave that product behind to someone else and advance your career.

The more readable source code is, the easier it is for someone to maintain that code. By following a consistent style, it allows other developers to step in and help with maintenance or new development.

By creating source code that is easier for a developer to understand, it becomes easier to find and correct bugs. It also provides a better view of how that code fits within the larger application and, in some cases, the company as a whole. This clearer view leads to the potential for more code reuse, which can have a dramatic affect on cost and development effort.

There is also a psychological factor that comes into play when adopting code standards. This factor is the sense of “code ownership”. Code ownership refers to a feeling of pride about the quality of the work done and a desire to see that code (product) do well. The higher the sense of ownership, the better the quality becomes.

This sense of code ownership increases as the application becomes more stable and the code becomes easier to maintain. The higher the sense of ownership, the better the developer feels about his skills (this is particularly true for newer developers). The better the developer feels about his skills, the better the code becomes.

If this sounds like a self-fulfilling prophecy, you’re right. When you feel better about yourself and the job you are able to perform, the quality of your work increases. As your quality increases so does your sense of self-worth in that job. This ends up creating a development team that has a strong sense of ownership of the code and a strong desire to see that product succeed.

By establishing and following a consistent set of code standards, you can foster this sense of ownership and improve the quality of the code being written.

Comments