Structural Programming: Basic Principles
Beginning of the information stage
The development of mankind more and more pushed the greatest minds at the thought of automating some processes. The beginning of the programming phase is attributed according to different sources to several periods in the interval from the beginning of the 19th to the middle of the 20th centuries. Over these decades, many techniques for writing source code have emerged. Each of them is fundamentally different in its principles and ideas. Consider the structured programming that emerged in the 70s of the last century.
A bit of history
Prior to the emergence of this technique, assembler was a very common language, which operated with simple commands that were later translated into machine code that could be directly understood by computers. This approach was used only for writing relatively small programs. In addition, it was extremely difficult to understand someone else's code, if not to say - impossible.But with the advent of the new methodology, the development process went much faster.
Basic principles of structured programming
Let us consider in detail the main points of the structural approach.
1. The source code has a modular structure. This means that the program is actually broken down into smaller units — functions and procedures. These routines can be called from anywhere in the development. Procedures are selected sections of code that have a name and perform specific actions specified by the algorithm. Functions in addition to these features implement the calculation of some variables, and also have a return value that can be used in the main part of the program. In addition, some languages support recursion - a call from "itself". This can be effective for solving problems, but it often leads to looping.
2. From top to bottom or bottom to top. Structural programming supports several directions. Consistent definition of goals, tasks and their implementation along the source code - a top-down approach. This technique is most understandable from the point of view of the study of the written program and the detection of "bottlenecks".However, there is another side - the bottom-up approach. It is usually used when the exact algorithm of the program has not yet been developed, but it is already possible to write separate subroutines that implement specific actions.
3. Controls. Structural programming has got rid of some "assembly" approaches. In low-level languages, an unconditional transition (goto) is often used, which is quite difficult to track and control. A structural programming approach instead uses the following elements: a loop, a condition, and a sequence.
With the development of this methodology, programming languages began to appear and develop. Structural approaches are implemented by such well-known ones as Pascal (Pascal), C (C), and the more outdated - Algol (Algol).
At one time, structural programming was fairly widespread in the environment of information technology and helped to solve the most difficult tasks for that period. However, life does not stand still, and technical progress requires fresh ideas.