Structured programming is a paradigm of computer programming due to the growing complexity of computer programs. It has emerged as a new programming model in order to create new programming techniques that can produce programs that are safe to operate for longer.
In the late 1960s, due to the rapid development of data processing with the computer, it was possible to address and solve increasingly complex problems. The large programs corresponding to these problems have become complicated to the extent that they have become very difficult to access even for their authors.
Understanding, debugging and modifying such programs sometimes presents unreliable difficulties. In that “software crisis,” the question arises naturally: “Can a general methodology be developed systematically, disciplined of some elegant programs?” In response to this question was born the structured programming method.
A structured program consists of well-defined functional units, hierarchized according to the intrinsic nature of the problem. Structured programming is a method independent of programming language, acting at work style level. What is actually structured programming? Structured programming is a way of conceiving programs according to well-established rules, using a certain set of small-scale control structures. A control structure means a combination of operations used in writing algorithms.
The purpose of structured programming is to develop easy-to-write, debug and modified (if needed) programs. The programs obtained are clear, orderly, understandable, without leaps and turns. Structured programming allows programs to be written in pseudocode, language-independent of the machine, close to the natural, convertible in any programming language.
By logically and clearly programming the admitted control structures, structured programming allows for an efficient approach to functions of any degree of difficulty. Structured programming is based on a mathematical justification provided by Boehm and Jacopini and known as the structural theorem that states that any algorithm with an input and output, that is, a single start point and a single termination point may be represented as a combination of three control structures:
1. Sequence or linear structure – the sequence of two or more operations;
2. Alternative decision or structure – choice of operation between two possible alternatives;
3. Cycle or repeat structure with initial test – repeating an operation as long as a certain condition is met.
Structured programming also allows the use of other control structures, such as:
1) Selection – allows a choice between more than two alternatives;
2) The final test cycle;
3) Cycle with counter.
The last two control structures represent variants of the structure generally referred to as the repetitive structure. Structured programming is an orientation in designing and building programs, with the goal of better management of their complexity, taking into account the peculiarities of human thinking. It is known that the program is based on an algorithm, and it can be represented by a logic scheme. In the case of complex programs (which are required to solve most of the real problems), the number of instructions being very large, the logic scheme may contain very complicated links between these instructions. It has been found; however, that man can not mentally master structures of high complexity. At one point, this deficiency of the human mind became a major hindrance to programming, because complex programs were hard to conceive and, above all, difficult to troubleshoot. It had become necessary to find a way to agree on the need to develop large and complex programs, with the human mind’s particularity of operating only with simple structures. The origins of structured programming are EW Dijkstra’s 1968 article titled ‘Go To Considered Harmful’, which shows that, in order to reduce the complexity of programs and ease their understanding, it is preferable to remove the GOTO instruction from the programs (go to) through which, in procedural programming languages, the jump from one instruction to the next is indicated.
Later on, Dijkstra and other computer science researchers conceived a coherent theory of structured programming, according to which, when designing a program, it is advisable to follow the following principles:
1. Structure theorem: any program can be compiled using only three fundamental control structures: sequential structure, alternate structure, and repetitive structure.
2. When designing programs, it is recommended to apply the descending technique (Top-Down English), also called the successive refinery technique.
3. Validity (visibility) ranges of variables and data structures must be limited.