Lecture
Procedural programming is programming in an imperative language, in which successively executed statements can be assembled into subroutines, that is, larger integral units of code, using the mechanisms of the language itself [1] .
Procedural programming is a reflection of the architecture of traditional computers, which was proposed by von Neumann in the 1940s. The theoretical model of procedural programming is an abstract computing system called the Turing machine.
The execution of a program is reduced to the sequential execution of statements in order to convert the initial state of the memory, that is, the values of the original data into the final, that is, into the results. Thus, from the point of view of the programmer, there is a program and a memory, with the first sequentially updating the contents of the latter.
A procedural programming language provides an opportunity for a programmer to determine each step in the process of solving a problem. The peculiarity of such programming languages is that tasks are divided into steps and solved step by step. Using a procedural language, the programmer determines the language constructs to perform a sequence of algorithmic steps.
Structural programming is a software development methodology based on the representation of a program in the form of a hierarchical block structure. Proposed in the 70s of the 20th century by E. Dijkstra, developed and supplemented by N. Wirth.
According to this methodology
In the program, the basic structures can be nested in each other in an arbitrary manner, but no other means of controlling the sequence of operations is provided.
First, the text of the main program is written, in which, instead of each connected logical fragment of text, a subroutine call is inserted that will execute this fragment. Instead of the present, working subroutines, “stubs” are inserted into the program, which do nothing. The resulting program is checked and debugged. After the programmer is satisfied that the subroutines are called in the correct sequence (that is, the general structure of the program is correct), the stub subroutines are successively replaced with actual ones, and the development of each subroutine is carried out by the same method as the main program. Development ends when there is no “gag” left that is not removed. Such a sequence ensures that at each stage of development the programmer simultaneously deals with the set of fragments that he can see and understand, and can be sure that the general structure of all higher levels of the program is correct. When accompanying and making changes to the program, it turns out which procedures need to be changed, and they are made without affecting parts of the program that are not directly related to them. This ensures that when making changes and correcting errors, some part of the program that is currently outside the programmer’s attention will not fail.
Structured Programming Theorem:
Main article: Boma-Jakopini theorem
Any algorithm scheme can be represented as a composition of nested blocks begin and end, conditional operators if, then, else, cycles with a precondition (while) and, maybe, additional logical variables (flags).
This theorem was formulated by the Italian mathematicians K. Bom and J. Yakopini in 1966 and tells us how to avoid using the goto transition operator.
The methodology of structured programming emerged as a consequence of the increasing complexity of the tasks solved on computers and the corresponding complication of software. In the 70s of the 20th century, the volume and complexity of programs reached such a level that “intuitive” (unstructured, or “reflex”) program development, which was the norm at an earlier time, ceased to meet the needs of practice. The programs became too complex to be properly maintained, so some sort of systematization of the program development and structure was required.
The most strongly criticized by developers of the structured approach to programming was the GOTO operator (unconditional transfer operator), which was then available in almost all programming languages. The incorrect and thoughtless use of arbitrary transitions in the program text results in confusing, poorly structured programs (so-called spaghetti code), the text of which makes it almost impossible to understand the order of execution and the interdependence of fragments.
Following the principles of structured programming has made the texts of programs, even fairly large, normally readable. The understanding of programs has become much easier, it has become possible to develop programs in a normal industrial mode, when a program can be easily understood not only by its author, but also by other programmers. This allowed the development of sufficiently large for that time software systems by the forces of development teams, and accompanying these systems for many years, even in the face of unavoidable changes in the staff.
The methodology of structural software development was recognized as the “strongest formalization of the 70s”. After that, the word “structural” became fashionable in the industry, and it began to be used wherever it was necessary and where it was not necessary. Appeared work on "structural design", "structural testing", "structural design" and so on. In general, roughly the same thing happened that happened in the 90s and is currently happening with the terms “object”, “object-oriented” and “electronic”.
Here are some advantages of structured programming:
Modularity in programming languages - the principle that the software (PS, program, library, web application, etc.) is divided into separate named entities, called modules. Modularity is often a means of simplifying the task of designing an PS and distributing the PS development process among development teams. When a substation is divided into modules, for each module the functionality it implements is indicated, as well as links to other modules. [one]
The role of modules can be played by data structures, function libraries, classes, services, and other software units that implement some functionality and provide an interface to it.
The program code is often split into several files, each of which is compiled separately from the others. Such modularity of the program code allows to significantly reduce the time of recompilation with changes made only in a small number of source files, and simplifies group development. It is also possible to replace individual components (such as jar files, so or dll libraries) of the final software product, without the need to rebuild the entire project (for example, developing plug-ins for an already finished program).
One of the methods for writing modular programs is object-oriented programming. OOP provides a high degree of modularity due to such properties as encapsulation, polymorphism and late binding.
Comments
To leave a comment
Algorithmization and programming. Structural programming. C language
Terms: Algorithmization and programming. Structural programming. C language