Introduction to Coding Standards

  • 4 minutes to read
  • edit

Style is an often overlooked but very critical attribute of writing. The style of writing directly impacts the readability and understandability of the end product. [1]

This statement is true not just for prose writing, but also for the style of programming in the writing of source code in a computer programming language. The readability and understandability of source code by humans is important not only for the creation of quality products but also in creating products that can be developed on schedule and within cost.

A comprehensive coding standard encompasses all aspects of code construction and is designed to improve program adaptation and maintenance. The readability of source code has a direct impact on how well a developer comprehends a software system. That comprehension has a direct impact on the correctness and reliability of that system. Code adaptation is a prerequisite to code reuse, which has the potential for large reductions in system development costs. Code maintainability refers to how easily that software system can be changed to add new features, modify existing features, fix bugs, or improve performance.

Although readability and maintainability are the result of many factors, one particular facet of software development upon which all developers have an influence is coding technique. The easiest method to ensure a team of developers will yield quality code is to establish a coding standard, which is then enforced at routine code reviews.

The guidelines defined here are not proposed to form an inflexible set of standards. Rather, they are meant to serve as a guide for developing a coding standard for software projects. Consistency is an important reason for the adoption of a set of common guidelines. Completed source code should reflect a harmonized style, as if a single developer wrote the code in one session. This adoption makes many critical project activities easier and simplifies formal and informal code reviews, system integration, and code reuse. 

Using solid coding techniques and good programming practices to create high-quality code plays an important role in software quality and performance. In addition, if you consistently apply a well-defined coding standard, apply proper coding techniques, and subsequently hold routine code reviews, a software project is more likely to yield a software system that is easy to comprehend and maintain.

To the New Programmer

In some ways, novice programmers have an advantage. Following the standards from the beginning allows you to develop a clear programming style that will effectively make use of the chosen programming language. While the rationale behind these guidelines helps the experienced programmer understand and accept the guidelines, you should initially focus on developing sound programming habits by concentrating on the guidelines themselves rather than the rationale. [2]

To the Experienced Programmer

As an experienced programmer, hopefully you are already writing code that follows many of these guidelines. However, you may have adopted a personal style that is different from those presented here and may be reluctant to change. Carefully review those guidelines that are inconsistent from your current style, make sure that you understand their rationale, and consider adopting them. [2] 

To the Software Project Manager

The role of the software project manager is to ensure the software produced in the course of a project is correct, reliable, maintainable, and portable. One of the ways these goals can be accomplished is by creating a commitment to producing high-quality code. In order to help create that commitment, code standards and guidelines should be defined and an understanding of why following those standards is critical to the success of the project should be fostered. Each guideline should be reviewed with the senior technical staff to arrive at a decision that constitutes the overall code standard. The senior technical staff should be responsible for ensuring the standard is followed and that the rest of the development staff understands the importance of the standards. [3]

[1] Ada 95 Quality and Style: Guidelines for Professional Programmers. SPC-94093-CMC. Herndon, Virginia. p-1.

[2] Ada 95 Quality and Style: Guidelines for Professional Programmers. SPC-94093-CMC. Herndon, Virginia. p-4.

[3] Ada 95 Quality and Style: Guidelines for Professional Programmers. SPC-94093-CMC. Herndon, Virginia. p-5.