Structured programming method



(e.w.dijikstra) in 1965, is an important milestone for software development. Its main point of view is the use of self-top, gradually refined programming methods; use three basic control structural constructors, any program can be constructed from the order, selection, and cycles. It is centered on modular design to divide the software system to be developed into several independent modules, which makes the operation of each module are simple and clear, and make a good foundation for designing some larger software.

Basic points

1. Using the top downward, gradually refer to programming method

in demand analysis, summary In the design, it is used as a method of self-bottom, layer-by-layer refinement.

2. Use three basic control structural constructors

any program can be constructed from the order, selection, and repeat three basic control structural configurations.

(1) Decompose the process in order, determine the execution order of each part.

(2) Decompose the process in the selection mode to determine the execution conditions of some part.

(3) Decompose process decomposition by looping, determine the conditions for the start and end of a portion.

(4) The above decomposition method is repeatedly used in the processing process, and it will eventually determine all details.

3. The organizational form of the main program means that the development program should adopt a main programmer (responsible for all technical activities), a backup programmer (coordination , Support the main programmer) and a program administrator (responsible for transactional work, such as collection, record data, document management, etc.), coupled with some experts (such as communications experts, database experts), other technicians Composition team.

Design Language

C, Fortran, Pascal, Ada, Basic

Structured programming method


Since the top down

When designing the program, consider the overall, then consider the details; first consider the global goals, consider local targets. Don't earn too much detail at the beginning, start designing from the top-level overall goal, gradually making problems.

Gradually refine the

for complex problems, some sub-target should be designed as a transition, gradually refined.

Modular design

a complex problem, is definitely consisting of several slightly simple questions. Modularity is to decompose the total target to be resolved into a sub-target, further decompose into a specific small object, refer to each small target as a module.

limits the origin of the structured program design method using the GOTO statement

from the understanding and debate on the GOTO statement. Affirming is that the abnormal exit at blocks and processes often needs to use the goto statement, using the goto statement to make the program perform efficiency; when the synthesis program target, the GOTO statement is often useful, such as returning the statement with goto. The negative conclusion is that the GOTO statement is harmful, and it is a disaster that caused the chaos. The quality of the program is inversely proportional to the number of goto statements. It should be canceled in all advanced programming languages. After canceling the GOTO statement, the program is easy to understand, easy to troubleshoot, easy to maintain, easy to perform correctness. As the conclusion of debate, 1974 Knuth issued a convincing summary and confirmed:

(1) GOTO statement is really harmful, should be avoided;

(2) is complete Avoid using a goto statement is not a wise method, some places use a goto statement, making the program process clearer, higher efficiency;

(3) The focus of the debate should not be placed on whether to cancel the goto statement And what kind of program structure should be placed. The most critical is that the GOTO statement should be restricted in the structured method of improving program clarity.

Basic Structure

Sequential Structure

Sequential Structure Representation The operation in the program is performed in the order in which they appear.

Select Structure

Select Structure Representation The processing step of the program has a branch, which requires one of the branches in which a particular condition is selected. Select structure with single selection, double selection, and more.

Cycle Structure

The loop structure representation program repeatedly executes one or some operations until a certain condition is fake (or true), it can terminate the loop. The most important thing in the loop structure is: What is the loop? Which operations need to be executed? There are two basic forms of the circulating structure: model cycles and until the cycle.

When the type loop : The first judgment condition is performed, and the cyclic body is performed when the given condition is satisfied, and the flow is automatically returned to the circulatory entry at the circular terminal; if the condition is not satisfied Then exit the cyclic body directly to the process outlet. Because it is "a loop when the condition is satisfied", it is determined before it is determined, so it is called a model loop.

Until the cycle : Indicates the circulation body directly from the structure inlet, judge the condition at the circular terminal, if the condition is not satisfied, the return entry continues to perform the cyclic body until the condition In the truth, you will then exit the circulation to the process exit, and then judge first. Because it is "until the condition is true", it is called until the loop.


Any basic structure in the structured program has a unique portal and unique outlet, and the program does not have a dead cycle. There is a good correspondence between the static form of the program and the dynamic execution process.


Since the module is independent of each other, when a module is designed, it will not be implicated by other modules, so that the original complicated problem can be simply simple. Module design. The independence of the module is also a lot of convenience to the establishment of a new system, because we can make full use of the existing modules for wood-type extensions.

According to the viewpoint of structured programming, any algorithm function can be implemented by a combination of three basic program structures consisting of program modules: sequential structure, selection structure, and loop structure.

The basic idea of ​​structured programming is the control structure of the "self-top, step-by-step refine" programming method and "single-inverting single export". Since the top, the programming method begins with the problem itself. After gradual refinement, the step of solving the problem is broken down into structured block diagram consisting of basic program structural modules; "single entrance export" thinking A complex program, if it is only combined, select, and cycling three basic program structures by combining, nested, then this new constructor must be a single-entrance population outlet. According to this, it is easy to write a good structure, easy to debug.

1 overall thinking, the target is clear.

2 The design work is very strong, which is conducive to the overall management and control of system development.

3 can diagnose problems and structural defects in the outbound system during system analysis.


1 User requirements are difficult to accurately define in the system analysis phase, resulting in a number of issues when the system is delivered.

2 Use the system to develop the results of each stage to control, and cannot adapt to the requirements of the changes.

3 The development cycle of the system is long.

Related Articles