Structured programming is a cross- language programming paradigm from the 1960s, i.e. before the software crisis . On the one hand, it contains the tree-like breakdown of a program into partial programs ( procedures ) and thus contains the paradigm of procedural programming . In addition, the structured programming on the lowest level requires the restriction to only three control structures :
- Sequence (program instructions to be executed one after the other)
- Selection / selection ( branching )
- Repetition / iteration ( loops )
The best-known consequence of this principle is the avoidance or - depending on the programming language - the restricted and standardized use of the jump instruction , the GOTO . The result of frequent use of these statements is often derogatoryly referred to as spaghetti code .
Through the consistent implementation of partial programs with local visibility of identifiers and control structures, structured programs avoid code repetitions , which has advantages in the search for program errors , makes the programs shorter and clearer and therefore simplifies the maintenance of software.
Structured programming is now a matter of course in almost all areas in which software is developed professionally . The newer programming paradigms such as generative programming , aspect-oriented programming or object-oriented programming build on structured programming and expand or supplement it.
A turning point towards structured programming was a publication by Corrado Böhm and his student Giuseppe Jacopini from 1966, which showed in the theorem of Böhm and Jacopini that programs can be restricted to the three control structures mentioned above, as well as the legendary essay Go To Statement Considered Harmful by Edsger W. Dijkstra from 1968. Niklaus Wirth , among others, paved the way for structured programming with the draft of the Pascal programming language.
Structured programming languages
Even if structured programming is in principle possible in all languages, even in assembler , it is certainly advantageous to use a procedural language. With the increasing spread of structured programming, languages have also been developed that contain elements that support structured programming and largely eliminate those that do not conform to this programming style. The following programming languages are suitable for structured programming:
- C and C ++
- C #
- COBOL (from COBOL 85)
- Fortran (from Fortran 77)
- Pascal , Modula-2 , Oberon and Component Pascal
- Visual Basic
- Go (programming language)
- O.-J. Dahl , EW Dijkstra , CAR Hoare : Structured Programming. Academic Press, London 1972, ISBN 0-12-200550-3 .
- David R. Tribble: Go To Statement Considered Harmful: A Retrospective (includes original article by Dijkstra with annotations by Tribble)
- Markus Bautsch:Wikibooks: Structured Programming - Learning and Teaching Materials
- Böhm, Jacopini Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules , Communications of the ACM, Volume 9, 1966, pp. 366-371, pdf
- Dijkstra: Go To Statement Considered Harmful. In: Communications of the ACM. 11, 3, 1968, pp. 147-148