You get a bonus - 1 coin for daily activity. Now you have 1 coin

Structured programming

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.

Content

  • 1 Basic Information
  • 2 Procedural programming languages
  • 3 Notes
  • 4 Literature
  • 5 References

Basic information

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.

Procedural programming languages

  • Ada (general purpose language)
  • Algol 60
  • Algol 68
  • Basic (before the appearance of Visual Basic)
  • Si
  • COBOL
  • Fortran
  • Modula-2
  • HAL / S
  • Pascal
  • Purebasic
  • PL / 1
  • Rapier
  • Rexx

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

  1. Any program is a structure built of three types of basic structures:
    • sequential execution - a single execution of operations in the order in which they are recorded in the text of the program;
    • branching - a single execution of one of two or more operations, depending on the fulfillment of a given condition;
    • cycle - repeated execution of the same operation as long as a certain condition is met (the condition of the continuation of the cycle).

    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.

  2. Repetitive program fragments (or non-repetitive, but constituting logically coherent computing units) can be formatted *** as so-called. subprograms (procedures or functions). In this case, in the text of the main program, instead of the fragment placed in the subroutine, the instruction to call the subroutine is inserted. When executing such an instruction, the called subroutine is executed, after which the execution of the program continues with the instruction following the *** call of the subroutine.
  3. The development of the program is carried out step by step, using the “top down” method.

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.

Story

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:

  1. Structural programming can significantly reduce the number of options for building a program for the same specification, which significantly reduces the complexity of the program and, more importantly, makes it easier for other developers to understand it.
  2. In structured programs, logically related operators are visually closer, and weakly related ones - further, which allows to avoid block-free diagrams and other graphical forms of image algorithms (in fact, the program itself is its own block diagram).
  3. The process of testing and debugging structured programs is greatly simplified.

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.

Content

  • 1 Modular software code
  • 2 Modular Programming
  • 3 Notes
  • 4 See also

Modular software code

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.

See also

created: 2014-08-21
updated: 2024-11-13
294



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Algorithmization and programming. Structural programming. C language

Terms: Algorithmization and programming. Structural programming. C language