General Coding Standards

by Pete Su

ACS Documentation : ACS Engineering Standards : General Coding Standards


The Big Picture

Experience shows that it is easier to develop code in large teams if people all follow a few standardized practices when writing code. Standards make code easier to read, and in general make a system easier to maintain because you don't have to spend time fighting with the strange coding ticks of 100 different people.

The tradeoff is that any given set of coding standards usually reflect the strange coding ticks of the single person or the small group of people who actually write the standards. People may complain that this will limit their own creativity, but this isn't really the case. Coding standards deal with the mechanical aspects of programming as opposed to anything that is really important. Therefore, it's not so important that the standards be "right" as much as it is that they be standard.

Related Reading

Here are some example coding standards documents I found on the net. While they seem to be specific to certain languages or environments, they all contain general ideas that are applicable anywhere. I include them here to give you an idea of the level at which standards are specified and applied.

CVS

The first rule for all code, and everything else, is that it be in CVS. Nothing that you work on, no matter how temporary, should be a plain file just sitting somewhere that is not version controlled in some way. Here are some basic guidelines:

Formatting

Follow the following general rules about file format:

Naming

Naming is important because the basis for all programming is giving a good name to an abstraction to make it easier to use. Try to follow these rules fo thumb for making up names in your code:

Comments in Code

The general rule here is to only use comments to clarify aspects of the code that are not immediately obvious. This is, of course, a subjective matter. Assume that a high level description of how the package is put together is available as a requirements or design document and so you don't have to explain those particulars in your code. On the other hand, if you use some incredibly clever algorithm or coding trick that is not discussed in the design, that would be a good thing to talk about.


Pete Su
Last Modified: coding.html,v 1.1 2001/01/21 01:49:07 bquinn Exp