Subscribe Us

header ads

Coding Standards and Guidelines


Coding :-

  • The coding is the process of transforming the design of a system into a computer language format. This coding phase of software development is concerned with software translating design specification into the source code. It is necessary to write source code & internal documentation so that conformance of the code to its specification can be easily verified.
  • Coding is done by the coder or programmers who are independent people than the designer.

Coding Standards :-

General coding standards refers to how the developer writes code.

The following are some representative coding standards :

1. Indentation: Proper and consistent indentation is essential in producing easy to read and maintainable programs.

Indentation should be used to emphasize the body of a control structure such as a loop or a select statement.

Emphasize the body of a conditional statement.

Emphasize a new scope block.

2. Inline comments: Inline comments analyze the functioning of the subroutine, or key aspects of the algorithm shall be frequently used.

3. Rules for limiting the use of global: These rules file what types of data can be declared global and what cannot.

4. Structured Programming: Structured (or Modular) Programming methods shall be used. "GOTO" statements shall not be used as they lead to "spaghetti" code, which is hard to read and maintain, except as outlined line in the FORTRAN Standards and Guidelines.


Coding Guidelines :-

General coding guidelines provide the programmer with a set of the best methods which can be used to make programs more comfortable to read and maintain.

The following are the some coding guidelines :

1. Line Length: It is considered a good practice to keep the length of source code lines at or below 80 characters. Lines longer than this may not be visible properly on some terminals and tools. Some printers will truncate lines longer than 80 columns.

2. Spacing: The appropriate use of spaces within a line of code can improve readability.

3. Avoid using a coding style that is too difficult to understand:

Code should be easily understandable. The complex code makes maintenance and debugging difficult and expensive.

4. Avoid using an identifier for multiple purposes:

Each variable should be given a descriptive and meaningful name indicating the reason behind using it. This is not possible if an identifier is used for multiple purposes and thus it can lead to confusion to the reader. Moreover, it leads to more difficulty during future enhancements.

5. Code should be well documented:

The code should be properly commented for understanding easily. Comments regarding the statements increase the understandability of the code.

6. Length of functions should not be very large:

Lengthy functions are very difficult to understand. That’s why functions should be small enough to carry out small work and lengthy functions should be broken into small ones for completing small tasks.

Post a Comment

0 Comments