Software Engineering (Experiments) : Krupali J Rana, Assistant Professor
Software Engineering (Experiments) : Krupali J Rana, Assistant Professor
(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)
• These rules tell about which types of data that can be declared global and the
data that can’t be.
• 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:
• Modification history
• Different functions supported in the module along with their input output
parameters
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).
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.
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:
• This is not possible if an identifier is used for multiple purposes and thus it can
lead to confusion to the reader.
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