Structured Coding Techniques of Software Development
Structured Coding Techniques of Software Development
techniques
Coding
• The coding is the process of transforming the design of a system into
a computer language format.
• OR Coding phase of software development is concerned with
translating design specification into the source code.
• Coding is done by the coder or programmers who are independent
people than the designer.
• The cost of testing and maintenance can be significantly reduced with
efficient coding.
• Goals of Coding
• To translate the design of system into a computer language
format: The coding is the process of transforming the design of a
system into a computer language format, which can be executed by a
computer and that perform tasks as specified by the design of
operation during the design phase.
• To reduce the cost of later phases: The cost of testing and
maintenance can be significantly reduced with efficient coding.
• Making the program more readable: Program should be easy to read
and understand. This helps in producing more maintainable software.
Structured Coding
• In structured programming, the whole program is sub divided into small
modules so that the program becomes easy to understand.
• The purpose of structured programming is to linearize control flow through a
computer program so that the execution sequence follows the sequence in
which the code is written.This linear flow of control can be managed
• This enhances the readability, testability, and modifiability of the program.
• Structured programming allows the programmer to understand the program
easily. (If a program consists of thousands of instructions and an error occurs
then it is complicated to find that error in the whole program, but in
structured programming, we can easily detect the error and then go to that
location and correct it which saves a lot of time.)
• Structured Rule 1: If the entry conditions are correct, but the exit
conditions are wrong, the error must be in the block. This is not true if
the execution is allowed to jump into a block.
• Structured Rule 2: A sequence of blocks is correct if the exit
conditions of each block match the entry conditions of the following
block. Execution enters each block at the block's entry point and
leaves through the block's exit point. The whole series can be
regarded as a single block, with an entry point and an exit point.
• Structured Rule 3: In structured programming, each choice is a code
block. There is one entry point (at the top) and one exit point (at the
bottom). The structure should be coded so that if the entry conditions
are fulfilled, then the exit conditions are satisfied (just like a code
block).
• Structured Rule 4: Iteration:Iteration (while-loop) is organized such
that it has one entry point and one exit point. The entry point has
conditions that must be satisfied, and the exit point has requirements
that will be fulfilled. There are no jumps into the form from external
points of the code.
• Structured Rule 5 :Nested Structures: A structure (of any size) that has
a single entry point and a single exit point is equivalent to a code
block.
• For example, we are designing a program to go through a list of
signed integers calculating the absolute value of each one. We
may (1) first regard the program as one block, then (2) sketch in the
iteration required, and finally (3) put in the details of the loop body, as
shown in the figure.
Coding Styles
• Programming style refers to the technique used in writing the source
code for a computer program.
• Most programming styles are designed to help programmers quickly
read and understands the program as well as avoid making errors.
• The goal of good programming style is to provide understandable,
straightforward, elegant code.
• The programming style used in a various program may be derived
from the coding standards of a company or computing organization,
as well as the preferences of the actual programmer.
Standards and Guidelines
• Good software development organizations maintain 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 may be rejected during code review.
• Purpose of Having Coding Standards:
• 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
Some of the coding standards are given
below:
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 the following that
is being used in various companies:
• Name of the module
• Date of module creation
• 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
3. Naming conventions for local variables, global variables, constants and functions: