What is structured programming ? Write the important features of it.

Explain the different approaches of structured programming.

Structured Programming:

Structured programming is one of the stages in the development and evolution of programming languages. In the first generation of computer, the only available language was machine language. This was very difficult to write and understand. The first stage of development of programming language was assembly language where Op-Code was replaced by mnemonics.

High level languages began to develop in 2nd  generation of computer and advanced in I

3rd generation. The main aim to develop HLL was that the programming should become easy. The programs should be easy to develop and maintain. This led to the development of structured programming.

The basic principle of good programming is that programs must be understandable. The traditional way was to view a program as a personal art or creation by an individual. At that time characteristics of a good programmer was to write complex programs, which are not easily understood. But such obscure programs are difficult to understand and maintain by another programmer and even after few months the programmer himself may find it very difficult to modify such programs.

Due to advancement in electronics technology the cost of hardware considerably decreased but the software cost is comparatively still high. For effective cost management now a days it is a need to write programs which are easy to understand, modify and maintain. This led to the development of structured programming. Structured Programming can be defined as collection of principles and practices that directs towards developing correct programs which are easy to understand and easy to maintain.

In early stage, in traditional unstructured program lots of unconditional branching statements such as ‘GOTO’ were used. So it became very difficult to follow the program logic. So instead of making modification in old program it was easier to write new program and scrap the old one. But in such cases the cost involved in developing old program was wasted.

Structured programming is characterized by clarity and simplicity in its logical flow of structure. It reads from top to bottom linearly instead of branching to previous statements. A simple, straight flow of logic from top to bottom is one of the principle of good programming and main objective of structured programming. To achieve this objective various control structures like Do-While,  Repeat-Until,  If-else-end if are provided in the structured programming language.

Structured programming follows following three basic logic structures while writing a computer program.

  1. Sequence logic: Sequence logic means the instructions are executed one after other in the order in which they occur. Its flow of logic is from top to bottom.
  2. Decision making logic or Selection logic: This logic is used for selecting the proper path out of two or more alternatives. For making decisions IF-THEN or IF-THEN-ELSE structure is used. If condition is true then the statements given after ‘THEN’ are executed. If the condition is false the statements given after ELSE are executed.
  3. Iteration logic (Loop): Iteration logic is used to produce loops. Loop means one or more instructions are to be executed several times depending on some condition. To specify a loop DO-WHILE or REPEAT-UNTIL loop structure is used.

In the DO-WHILE loop, the loop will continue until the condition is true; When the condition becomes false the loop stops. Were as in Repeat-Until, the loop is executed until the condition becomes true. That is execution of loop takes place as long as the condition is false and stops when condition becomes true. The condition is tested automatically after each execution of loop statements.

Thus structured programming reduces complexity and the program becomes easy to develop, modify and maintain. For a big task / program, instead of writing one big program the task is divided into no. of small parts called as modules. Each module is a well defined program segment. Each module is developed and tested separately and then all the modules are collected and linked together and run as a single unit. This modular programming helps in clarity and simplicity of program.

Structured program consists of smaller interconnected parts called as modules; each part (module) is simple and comprehensible. A large program is decomposed into smaller parts called as modules and the modules are interdependent.  Thus the program is developed by proceeding from general to specific i.e by using top-down approach.

After the structured programming approach now the latest approach towards programming is OOP (Object Oriented Programming) Language. The 4 GL (Fourth Generation Languages) are object oriented languages and instead of processing logic (step by step instructions) they are also able to process knowledge. They are able to process graphics input, photos and pictures etc.