Control constructs
Many people wrongly equate the term "structured programming" with "GO TO-less code", or even worse, programs from which GO TO's have been eliminated after the fact. This is probably a result of the wide reference to a famous letter by Edsger Dijkstra to the editor of the CACM entitled "Go To Statement Considered Harmful". In this letter the point is made that the quality (by his definition) of a piece of software is a decreasing function of the number of GO TO's used. In actual fact, Bohm and Jacobini's paper on control constructs published in 1966 is more properly considered the original contribution to the discipline of stuctured programming. The points to be made here are that :
- 1 A well structured program contains few or no GO TO statements
- 2 Condition 1 is a necessary, but not sufficient definition of a well structured program, and
- 3 Structured programming is almost half as old as the field of computer science itself.
The basic approach to well behaved control flow within modules is to use only sequential flow or block constructs (such as do-while, do-until, if-then-else, case). Block structures control constructs have single entry points (to the block) and single exit points (from the block).