structured programming

views updated

structured programming
1. A method of program development that makes extensive use of abstraction in order to factorize the problem and give increased confidence that the resulting program is correct. Given the specification of a required program, the first step is to envisage some “ideal” machine on which to implement that program. This ideal machine should offer both an appropriate set of data structures and an appropriate set of operations on those data structures. The required program is then defined as a program for the specified ideal machine.

By this means the original problem has been reduced to one of implementing the specified ideal machine, and this problem is itself tackled in the same way. A second ideal machine is envisaged, this machine being ideal for implementing the data structures and operations of the first machine, and programs are produced to effect the implementation. This process continues until eventually a level is reached at which the specified data structures and operations of the ideal machine can conveniently be implemented directly in the chosen programming language. Thus the eventual program is based upon “levels of abstract machine”, where the top-level machine is ideally suited to the specific application and the lowest-level machine directly executes the chosen programming language. The development process is not, however, simply one of “subroutinization”, since both operations and data structures are refined simultaneously at each level.

The overall method of structured programming, which is largely due to E. W. Dijkstra, is heavily influenced by a concern for program correctness. The intention is that at any level the implementation machine should be so well suited to the problem at hand that the programs for that machine will be small and simple. It should therefore be possible at each level to provide a convincing rigorous argument that the programs are correct.

2. (structured coding) An approach to coding in which only three constructs are employed for governing the flow of control through the program. These three constructs allow for sequential, conditional, and iterative control flow. Arbitrary transfer of control (i.e. the GOTO statement) is expressly forbidden. As a direct result, for each compound statement within the program there is precisely one entry point and one exit point, and reasoning about the program is thereby made easier.

More From encyclopedia.com