Software Coding and Standards

Good software development organizations require their programmers to follow standard style of coding called coding standards.
The purpose of following coding standards is:
· A coding standard gives a uniform appearance to the codes written by different engineers.
· It helps code understanding.
· It encourages good programming practices.
The following are some coding standards:

a) Rules for limiting the use of global: These rules describe what types of data can be declared
global and what cannot.
b) Contents of the headers preceding codes: The information contained in the headers of different modules should be standard, for e.g.: Name of the module, Date on which the
module was created, Author’s name, Modification history, Global variables
accessed/modified by the module, etc.
c) Naming conventions for global variables, local variables, and constant identifiers: A possible naming convention can be that global variable names always start with a capital letter, local variable names are made of small letters, and constant names are always capital letters.
d) Conventions regarding error return values and exception handling mechanisms: The way error conditions are reported by different functions in a program should be standard within an organization. For example, different functions while encountering an error condition should either return a 0 or 1 consistently.
Coding Guidelines recommended by many software development organizations:
a) Do not use a coding style that is too difficult to understand: It makes maintenance
difficult.
b) Avoid obscure side effects: An obscure side effect is one that is not obvious from a casual examination of the code. Obscure side effects make it difficult to understand a piece of code.
c) Do not use an identifier for multiple purposes: Programmers often use the same identifier to denote several temporary entities. This makes future enhancement difficult. It is recommended to give each variable should be given a descriptive name indicating its purpose.
d) The code should be well-documented: As a rule of thumb, there must be at least one
comment line on the average for every three-source line.
e) Do not use goto statements: Use of goto statements makes a program unstructured and makes it very difficult to understand

Leave a comment