Structured Programming

Structured programming is the practice of composing programs out of a small set of clear control structures, such as sequences, conditional choices, and loops, instead of letting control jump freely around the code. The goal is to keep the static text of a program and its behavior as it runs closely matched, so a human can follow what the program does.

Edsger W. Dijkstra set out the case for this discipline in his 1969 notes circulated as EWD249, “Notes on Structured Programming.” There he argues that “the extent to which the program correctness can be established is not purely a function of the program’s external specifications and behaviour but depends critically upon its internal structure.” In other words, how a program is built decides whether anyone can be confident it is correct.

The same notes contain his often-quoted warning that “program testing can be used to show the presence of bugs, but never to show their absence,” which is why he stressed structuring programs so they can be reasoned about rather than only tested.

Structured programming grew out of Dijkstra’s earlier objection to the unrestricted go to statement and became a dominant approach to program design. Its control structures are now built into nearly every mainstream programming language.