
[计] 结构化程序设计
However, EVALUATE provides more, better options that encourage the use of structured programming.
然而,EVALUATE 提供了更多、更好的选项,鼓励使用结构化编程。
According to structured programming, the software of the lower machine is composed by the main program, the subroutine and interrupt service routine.
按照结构化编程思想,将下位机软件划分为主程序、子程序和中断程序三部分分别进行设计。
That is why there is research in software design, programming methods, structured programming and related topics.
这就是为什么存在对软件设计,编程方法,结构编程和相关话题的研究。
The C programming language is a general-purpose programming language that provides code efficiency, elements of structured programming, and a rich set of operators.
语言是一种通用编程语言,代码效率较高,并提供了结构化编程元素和一组丰富的操作符。
It is a kind of structured programming language with structured control statements.
结构化语言,提供结构化控制语句。
They create abstract concepts using very structured programming languages (like PHP or Java).
他们使用一种非常结构化的语言,却实现了很抽象的概念。
In the software design, it follows the principle of modularization and structured programming, uses C and inline assembly as the programme languages.
软件设计采用模块化编程和结构化编程的思想、C语言和汇编语言嵌套编程的方式。
This advance, carried out under the banner of structured programming, has led to programs that are more reliable and easier to comprehend;
这个进步是在“结构化编程”的大旗下发展起来的,尽管结果并非完美,但它让程序变得更可靠也更易读。
The software was designed following the principle of modularization and structured programming and using assembly as the programme languages.
在软件方面利用汇编语言,采用模块化编程和结构化编程。
I started programming as industry (and academia) were adopting structured programming.
我开始做编程行业(及学术编程)时采用的是结构化编程模式。
And Rexx is certainly Turing-complete, enables modules and structured programming, and has libraries for tasks such as GUI interfaces, network programming, and database access.
并且,Rexx当然是完全Turing的,支持模块和结构化编程,有面向专门任务的库,例如GUI接口、网络编程和数据库访问。
The paper deals with the principle and structured programming of a microcomputer numerical control (MNC) system that is used on NC machining the turbine impeller with 5-dimension interpolation.
五维插补数控加工透平叶轮的微机数控(MNC)系统主要论述数控加工整体透平叶轮的微机数控系统的结构、工作原理和多维插补法。
The software of system is programmed. The Modular Structured Programming makes the program readable and modifiable.
在控制软件设计中采用模块化编程,增强了程序的通用性和可读性。
This is the writer's version of structured programming and the DRY principle (Don't Repeat Yourself).
具体的方法取决于撰写者对结构化编程和DRY(Don'tRepeatYourself,不要重复自己)原则的认识。
In this way we can solute ill-structured goal programming problem and think about priority class and the constraint values that are changing with the environment.
这样就可以解决目标规划中的结构不良的问题和考虑目标函数中的优先等级及右端值等随环境变化的情况。
This course is an introduction to structured computer programming.
该课程主要介绍结构性计算机编程。
结构化编程(Structured Programming)是一种软件开发范式,其核心思想是通过特定的控制结构来组织程序逻辑,以提升代码的清晰度、可读性、可维护性和可靠性。它旨在取代早期编程中过度依赖“GOTO”语句导致的复杂、难以理解的“面条式代码”(spaghetti code)。
其详细含义包含以下关键点:
核心控制结构:结构化编程规定程序应仅由三种基本控制结构组合而成:
if-then-else
, case
/switch
)。while
, for
)。
理论上(Böhm-Jacopini定理),任何可计算函数都可以仅用这三种结构实现,无需随意跳转的 GOTO
语句。模块化(Modularity):程序被分解为一系列独立的、功能明确的子程序(如函数、过程、方法)。每个模块应具有单一职责,并通过定义良好的接口与其他模块交互。这促进了代码复用和分工协作。
单入口单出口(Single Entry, Single Exit - SESE):每个控制结构(尤其是模块)应只有一个入口点和一个出口点。这简化了程序流程的理解和调试,避免了因多个入口/出口导致的复杂状态追踪。
避免(或限制)使用GOTO语句:虽然并非完全禁止,但结构化编程极力主张避免随意使用 GOTO
语句进行非结构化的跳转,因为它会破坏代码的线性逻辑流,增加理解难度和出错概率。复杂的控制逻辑应通过上述三种基本结构来表达。
自顶向下设计(Top-Down Design):一种常用的设计方法,从程序要解决的总体问题(顶层抽象)开始,逐步将其分解为更小、更具体的子问题(模块),直到每个子问题都可以直接用编程语言实现。这有助于管理复杂性。
价值与影响:
结构化编程的概念主要由 Edsger W. Dijkstra 在1968年发表的著名信件《GOTO语句被认为有害》中大力推广,并由 Corrado Böhm 和 Giuseppe Jacopini 在1966年从理论上证明其可行性(Böhm-Jacopini定理)。它已成为现代软件开发不可或缺的基础原则之一。
补充说明: 结构化编程主要关注程序内部的逻辑组织方式(控制流和模块化),它与编程语言范式(如过程式、面向对象)并非同一层级的概念。过程式语言(如C、Pascal)天然支持结构化编程,而面向对象语言(如Java、C#)在其方法实现层面也广泛应用结构化编程原则。
结构化定理的数学表达(Böhm-Jacopini定理): 任何可计算函数都可以通过组合以下三种基本控制流模式来实现: $$ begin{align} text{1. 顺序:} & quad S1; S2 text{2. 选择:} & quad text{if } C text{ then } S1 text{ else } S2 text{3. 循环:} & quad text{while } C text{ do } S end{align} $$ 其中 $S, S1, S2$ 代表语句块,$C$ 代表条件表达式。
参考资料:
结构化编程(Structured Programming)是一种编程范式,强调通过清晰的逻辑结构和模块化设计来提高代码的可读性、可维护性和可靠性。以下是其核心要点:
结构化编程主张使用三种基本控制结构组织代码:
if-else
、switch
)实现分支逻辑。for
、while
等循环重复执行代码块。GOTO
语句:传统编程依赖 GOTO
导致代码混乱(称为“面条式代码”),结构化编程用上述控制结构替代。GOTO
的滥用,成为结构化编程的理论基础。GOTO
):10 PRINT "Enter a number: "
20 INPUT N
30 IF N < 0 THEN GOTO 60
40 PRINT "Positive"
50 GOTO 70
60 PRINT "Negative"
70 END
if-else
):n = int(input("Enter a number: "))
if n >= 0:
print("Positive")
else:
print("Negative")
结构化编程通过规范代码组织方式,显著提升了软件开发效率和质量,至今仍是编程教育的基础内容。
【别人正在浏览】