结构化编程-Structured programming
结构话编程强调的是对流程的控制;
它为面向过程编程提供天然的支持。
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures, for and while loops—in contrast to using simple tests and jumps such as the go to statement, which could lead to "spaghetti code" that is difficult to follow and maintain.
Control structures[edit]
Following the structured program theorem, all programs are seen as composed of control structures:
- "Sequence"; ordered statements or subroutines executed in sequence.
- "Selection"; one or a number of statements is executed depending on the state of the program. This is usually expressed with keywords such as
if..then..else..endif. - "Iteration"; a statement or block is executed until the program reaches a certain state, or operations have been applied to every element of a collection. This is usually expressed with keywords such as
while,repeat,forordo..until. Often it is recommended that each loop should only have one entry point (and in the original structural programming, also only one exit point, and a few languages enforce this). - "Recursion"; a statement is executed by repeatedly calling itself until termination conditions are met. While similar in practice to iterative loops, recursive loops may be more computationally efficient, and are implemented differently as a cascading stack.
Graphical representation of the three basic patterns — sequence, selection, and repetition — using NS diagrams (blue) and flow charts (green).
Subroutines[edit]
Subroutines; callable units such as procedures, functions, methods, or subprograms are used to allow a sequence to be referred to by a single statement.
Blocks[edit]
Blocks are used to enable groups of statements to be treated as if they were one statement. Block-structured languages have a syntax for enclosing structures in some formal way, such as an if-statement bracketed by if..fias in ALGOL 68, or a code section bracketed by BEGIN..END, as in PL/I, whitespace indentation as in Python - or the curly braces {...} of C and many later languages.
https://en.wikipedia.org/wiki/Structured_programming
结构化编程-Structured programming的更多相关文章
- C++程序结构---1
C++ 基础教程Beta 版 原作:Juan Soulié 翻译:Jing Xu (aqua) 英文原版 本教程根据Juan Soulie的英文版C++教程翻译并改编. 本版为最新校对版,尚未定稿.如 ...
- [3]第二章 C++编程简介
(本资料均从 internet 上进行收录整理,若要转载,请与原作者联系) 2.1 机器语言.汇编语言和高级语言 程序员用各种编程语言编写指令,有些是计算机直接理解的,有些则需要中间翻译(tranl ...
- Reading | 《C++ Primer Plus》(未完待续)
目录 一.概述和C++简史 1.早期语言的问题 2.面向对象编程OOP 3.泛型编程 二.入门 1.头文件 2.名称空间 3.cout输出 4.C++语句 5.函数 一.概述和C++简史 C++融合了 ...
- 文艺编程 Literate Programming
(译注:这篇文章是 Donald Knuth 一篇1983年的论文:Literate Programming 的介绍部分.有人翻译为“字面编程”,是极其错误的说法,literate 根本就没有“字面” ...
- Core Java Volume I — 4.1. Introduction to Object-Oriented Programming
4.1. Introduction to Object-Oriented ProgrammingObject-oriented programming, or OOP for short, is th ...
- Chapter 1 An Overview of Computers and Programming Languages
Babylon巴比伦 loom织布机 weaver, WHO uses loom to work census: to count the population tabulate: make into ...
- 2018-02-27 "Literate Programming"一书摘记之一
书到后才发现是Knuth的论文集, 第一篇就在网上: Computer programming as an art (1974). 其中"Taste and Style"(品味和风 ...
- DCI:The DCI Architecture: A New Vision of Object-Oriented Programming
SummaryObject-oriented programming was supposed to unify the perspectives of the programmer and the ...
- Comparison of programming paradigms
Main paradigm approaches[edit] The following are widely considered the main programming paradigms, a ...
随机推荐
- 如何选择优动漫PAINT版本?是个人版还是EX版
优动漫PAINT也就是我们常说的clip studio paint(CSP)的中文版本,它是一款功能强大的动漫绘图软件,适用于个人和专业团队创作,分为个人版和EX版.搭载了绘制漫画和插画所需的所有功能 ...
- 【leecode】独特的电子邮件地址
每封电子邮件都由一个本地名称和一个域名组成,以 @ 符号分隔. 例如,在 alice@leetcode.com中, alice 是本地名称,而 leetcode.com 是域名. 除了小写字母,这些电 ...
- 路飞学城Python-Day77
11-DIY一个web框架3 web框架 yuan功能总结 main.py: 启动文件,封装了socket 1 urls.py: 路径与视图函数映射关系 ---- url控制器 2 views.py ...
- MySQL py模块的链接Navicat可视化工具
数据库可视化工具Navicat 1 基本操作: 1 库 表 字段 记录(增删改查) 2 添加主建,添加自增. 3 添加外键,外键的链接 4 模型建表,模型添加外键.(逆向数据库到模型,运行SQL文件 ...
- 训练1-B
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer). 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍 ...
- C#通过SendMessage发送消息,改变其他程序的下拉框控件(ComboBox)的值
IntPtr cbh= new IntPtr(handle); //ComboBox的句柄 SendMessage(cbh, 0x014D, new IntPtr(-1), "需要选中的下拉 ...
- 00074_Array类
1.Array类的概述 此类包含用来操作数组(比如排序和搜索)的各种方法.需要注意,如果指定数组引用为 null,则访问此类中的方法都会抛出空指针异常NullPointerException. 2.常 ...
- 参数化取值策略Unique
Unique:主要是强调取值的唯一性,如果到最后没有该值了,LR提供了其他解决方案,如图所示: 此处的下拉列表中提供了三种方式,具体如下: About Vuser,当取值次数超过参数的行数时,忽略脚本 ...
- web.xml 中context-param元素
context-param元素含有一对参数名和参数值,用作应用的ServletContext上下文初始化参数.参数名在整个Web应用中必须是惟一的 param-name 子元素包含有参数名,而para ...
- BA-ALC控制模块