0% found this document useful (0 votes)
41 views

Software Engineering (Experiments) : Krupali J Rana, Assistant Professor

The document discusses coding standards and their importance. It defines coding standards as a set of guidelines for programming style, formatting, naming conventions and best practices. Maintaining coding standards improves code readability, maintainability and reduces complexity. It also promotes sound programming practices. The document then provides examples of specific coding standards like limiting global variables, using consistent headers, meaningful naming conventions, proper indentation and error handling.

Uploaded by

Jaydeep Dabhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Software Engineering (Experiments) : Krupali J Rana, Assistant Professor

The document discusses coding standards and their importance. It defines coding standards as a set of guidelines for programming style, formatting, naming conventions and best practices. Maintaining coding standards improves code readability, maintainability and reduces complexity. It also promotes sound programming practices. The document then provides examples of specific coding standards like limiting global variables, using consistent headers, meaningful naming conventions, proper indentation and error handling.

Uploaded by

Jaydeep Dabhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Software Engineering

(Experiments)
Krupali J Rana, Assistant Professor
CSE, PIT
Experiment-8
Defining Coding Standards and walk through.
Aim: Defining Coding Standards and walk through.

Objectives: The main goal of the coding phase is to code from the design document
prepared after the design phase through a high-level language and then to unit test this
code.
Theory/Concepts/Formulas (If Applicable)

• Good software development organizations want their programmers to


maintain to some well-defined and standard style of coding called coding
standards.
• They usually make their own coding standards and guidelines depending
on what suits their organization best and based on the types of software
they develop.
• It is very important for the programmers to maintain the coding standards
otherwise the code will be rejected during code review.
Theory/Concepts/Formulas (If Applicable)

• A coding standard gives a uniform appearance to the codes written by


different engineers.
• It improves readability, and maintainability of the code and it reduces
complexity also.
• It helps in code reuse and helps to detect error easily.
• It promotes sound programming practices and increases efficiency of the
programmers.
Coding Standards
1. Limited use of globals:

• These rules tell about which types of data that can be declared global and the
data that can’t be.

2. Standard headers for different modules:

• For better understanding and maintenance of the code, the header of different
modules should follow some standard format and information. The header
format must contain below things that is being used in various companies:

• Name of the module

• Date of module creation


Coding Standards
2. Standard headers for different modules:

• Author of the module

• Modification history

• Synopsis of the module about what the module does

• Different functions supported in the module along with their input output
parameters

• Global variables accessed or modified by the module


Coding Standards
3. Naming conventions for local variables, global variables, constants and
functions:

Meaningful and understandable variables name helps anyone to understand the


reason of using it.

Local variables should be named using camel case lettering starting with small
letter (e.g. localData) whereas Global variables names should start with a capital
letter (e.g. GlobalData). Constant names should be formed using capital letters
only (e.g. CONSDATA).

It is better to avoid the use of digits in variable names.

The names of the function should be written in camel case starting with small
Coding Standards
3. Naming conventions for local variables, global variables, constants and
functions:

The names of the function should be written in camel case starting with small
letters.

The name of the function must describe the reason of using the function clearly
and briefly.
Coding Standards
4. Indentation:

Proper indentation is very important to increase the readability of the code. For
making the code readable, programmers should use White spaces properly. Some
of the spacing conventions are given below:

There must be a space after giving a comma between two function arguments.

Each nested block should be properly indented and spaced.


Coding Standards
4. Indentation:

Proper Indentation should be there at the beginning and at the end of each block
in the program.

All braces should start from a new line and the code following the end of braces
also start from a new line.
Coding Standards
5. Error return values and exception handling conventions:

All functions that encountering an error condition should either return a 0 or 1 for
simplifying the debugging.

All braces should start from a new line and the code following the end of braces
also start from a new line.
Coding Standards
6. 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.
Coding Standards
7. 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.


Coding Standards
8. Code should be well documented:

The code should be properly commented for understanding easily. Comments


regarding the statements increase the understandability of the code.
Coding Standards
9. 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.
Experiment Demonstration

You might also like