Home Common Problem What are the principles of structured programming?

What are the principles of structured programming?

Mar 10, 2021 am 11:45 AM
structured programming

There are four main principles of structured programming: 1. Top-down; start designing from the top overall goal and gradually make the problem concrete. 2. Gradually seek refinement; for complex problems, some sub-goals should be designed as transitions and gradually refined. 3. Modularization. 4. Limit the use of goto statements.

What are the principles of structured programming?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

Structured programming is the basic principle for detailed design focusing on module function and process design. Structured programming is a subset of procedural programming that uses logical structures in written programs to make understanding and modification more efficient and easier.

There are four main principles of structured programming:

1. Top-down: When designing a program, you should consider the overall situation first and then the details; consider the global goals first and then the local goals. Don't pursue too many details at the beginning. Start designing from the top overall goal and gradually make the problem concrete.

2. Gradual refinement: For complex problems, some sub-goals should be designed as transitions and gradually refined.

3. Modularization: A complex problem must be composed of several simpler problems. Modularization is to decompose the overall goal to be solved by the program into sub-goals, and then further decompose it into specific small goals, and call each small goal a module.

4. Limit the use of goto statements

The origin of structured programming methods comes from the understanding and debate on GOTO statements. The definite conclusion is: GOTO statements are often needed at abnormal exits of blocks and processes. Using GOTO statements will make program execution more efficient; GOTO statements are often useful when synthesizing program targets, such as using GOTO for return statements.

The negative conclusion is: GOTO statements are harmful and the root of program confusion. The quality of the program is inversely proportional to the number of GOTO statements. GOTO statements should be canceled in all high-level programming languages. After canceling the GOTO statement, the program is easy to understand, easy to troubleshoot, easy to maintain, and easy to prove correctness. As a conclusion to the debate, in 1974 Knuth published a convincing summary and eliminated the GOTO statement.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What are the principles of structured programming?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)