On the Criteria To Be Used in Decomposing Systems into Modules
### 模块化系统分解的标准 #### 引言与背景 本文探讨了模块化作为提高系统灵活性、可理解性,并缩短开发周期的有效机制。模块化的有效性取决于将系统划分为各个模块时所采用的标准。作者通过一个系统设计问题的示例,展示了传统与非传统分解方法的不同之处,并指出非传统分解在实现既定目标方面具有明显优势。 #### 关键知识点 ##### 模块化(Modularization) - **定义**:模块化是一种软件工程方法,它将大型复杂系统分解为较小的、更易于管理的部分(即模块)。 - **目的**: - 提高系统的可维护性和可扩展性。 - 使不同模块可以独立开发、测试和调试。 - 便于复用代码。 - **实现方式**:通常通过将系统功能细分成多个子程序或类来实现。 ##### 模块(Module) - **定义**:模块是系统的一个组成部分,通常包含一组相关的功能或数据。 - **特性**: - 内聚性:模块内部的功能紧密相关。 - 耦合性:模块之间交互的程度较低。 - **作用**:模块的设计旨在简化系统的理解和维护过程。 ##### 分解标准(Criteria for Decomposition) - **关键因素**:在进行系统模块化时,选择合适的分解标准至关重要。这些标准包括但不限于: - 功能相似性:根据模块执行的功能相似度进行分组。 - 数据共享:基于模块间的数据依赖关系划分。 - 通信模式:考虑模块之间的交互频率和类型。 - 独立性:确保模块尽可能地自包含,减少对外部环境的依赖。 - **案例分析**:文章中提供了一个具体的系统设计问题,比较了两种不同的分解方法——传统方法与非传统方法。非传统分解虽然可能在某些情况下效率较低,但更符合提高系统灵活性和可理解性的目标。 ##### 实现方式(Implementation Approaches) - **传统实现**:每个模块通常由一个或多个子程序组成。 - **替代实现**:文中提到一种不会导致效率降低的替代实现方案,但具体细节未详述。 - **关键考量**:无论采取哪种实现方式,都应考虑模块间的接口清晰度、模块内部的结构优化以及整体系统的性能需求。 ##### 结论 - **核心思想**:模块化是提高软件质量的重要手段之一。 - **实践建议**:为了有效地进行系统模块化,需要综合考虑多种分解标准,同时评估不同实现方式对系统性能的影响。 - **未来方向**:随着软件工程的发展,探索更多创新的模块化方法和技术将是未来研究的重点。 #### 小结 《用于将系统分解为模块的标准》一文深入探讨了模块化在系统分析与设计中的应用。通过对不同分解方法的比较,作者强调了选择合适分解标准的重要性。此外,文章还提到了几种实现模块化的具体方式及其潜在优势和局限性。对于从事软件工程领域的专业人士而言,理解这些概念和技术对于构建高质量、易于维护的软件系统至关重要。
D.L. Parnas
Carnegie-Mellon University
Reprinted from Communications of the ACM, Vol. 15, No. 12, December 1972 pp. 1053 - 1058 Copyright ? 1972, Association for Computing Machinery Inc.
This is a digitized copy derived from an ACM copyrighted work. It is not guaranteed to be an accurate copy of the author's original work.
--------------------------------------------------------------------------------
This paper discusses modularization as a mechanism for improving the flexibility and comprehensibility of a system while allowing the shortening of its development time. The effectiveness of a "modularization" is dependent upon the criteria used in dividing the system into modules. A system design problem is presented and both a conventional and unconventional decomposition are described. It is shown that the unconventional decompositions have distinct advantages for the goals outlined. The criteria used in arriving at the decompositions are discussed. The unconventional decomposition, if implemented with the conventional assumption that a module consists of one or more subroutines, will be less efficient in most cases. An alternative approach to implementation which does not have this effect is sketched.
Key Words and Phrases: software, modules, modularity, software engineering, KWIC index, software design
CR Categories: 4.0
--------------------------------------------------------------------------------
Introduction
A lucid statement of the philosophy of modular programming can be found in a 1970 textbook on the design of system programs by Gouthier and Pont [1,10.23], which we quote below:
A well-defined segmentation of the project effort ensures system modularity. Each task forms a separate, distinct program module. At implementation time each module and its inputs and outputs are well-defined, there is no confusion in the intended interface with other system modules. At checkout time the integrity of the module is tested independently; there are few scheduling problems in synchronizing the completion of several tasks before checkout can begin. Finally, the system is maintained in modular fashion, system errors and deficiencies can be traced to specific system modules, thus limiting the scope of detailed error searching.
Usually nothing is said about the criteria to be used in dividing the system into modules. This paper will discuss that issue and, by means of examples, suggest some criteria which can be used in decomposing a system into modules.
A Brief Status Report
The major advancement in the area of modular programming has been the development of coding techniques and assemblers which (1) allow one module to be written with little knowledge of the code in another module, and (2) allow modules to be reassembled and replaced without reassembly of the whole system. This facility is extremely valuable for the production of large pieces of code, but the systems most often used as examples of problem systems are highly modularized programs and make use of the techniques mentioned above.
Expected Benefits of Modular Programming
The benefits expected of modular programming are: (1) managerial_development time should be shortened because separate groups would work on each module with little need for communication: (2) product flexibility_it should be possible to make drastic changes to one module without a need to change others; (3) comprehensibility_it should be possible to study the system one module at a time. The whole system can therefore be better designed because it is better understood.
What Is Modularization?
Below are several partial system descriptions called modularizations. In this context "module" is considered to be a responsibility assignment rather than a subprogram. The modularizations include the design decisions which must be made before the work on independent modules can begin. Quite different decisions are included for each alternative, but in all cases the intention is to describe all "system level" decisions (i.e. decisions which affect more than one module).
Example System 1: A KWIC Index Production System
The following description of a KWIC index will suffice for this paper. The KWIC index system accepts an ordered set of lines, each line is an ordered set of words, and each word is an ordered set of characters. Any line may be "circularly shifted" by repeatedly removing the first word and appending it at the end of the line. The KWIC index system outputs a listing of all circular shifts of all lines in alphabetical order.
This is a small system. Except under extreme circumstances (huge data base, no supporting software), such a system could be produced by a good programmer within a week or two. Consequently, none of the difficulties motivating modular programming are important for this system. Because it is impractical to treat a large system thoroughly, we must go through the exercise of treating this problem as if it were a large project. We give one modularization which typifies current approaches, and another which has been used successfully in undergraduate class projects.
Modularization 1
We see the following modules:
Module 1: Input. This module reads the data lines from the input medium and stores them in core for processing by the remaining modules. The characters are packed four to a word, and an otherwise unused character is used to indicate the end of a word. An index is kept to show the starting address of each line.
Module 2: Circular Shift. This module is called after the input module has completed its work. It prepares an index which gives the address of the first character of each circular shift, and the original index of the line in the array made up by module 1. It leaves its output in core with words in pairs (original line number, starting address).
Module 3: Alphabetizing. This module takes as input the arrays produced by modules I and 2. It produces an array in the same format as that produced by module 2. In this case, however, the circular shifts are listed in another order (alphabetically).
Module 4: Output. Using the arrays produced by module 3 and module 1, this module produces a nicely formatted output listing all of the circular shifts. In a sophisticated system the actual start of each line will be marked, pointers to further information may be inserted, and the start of the circular shift may actually not be the first word in the line, etc.
Module 5: Master Control. This module does little more than control the sequencing among the other four modules. It may also handle error messages, space allocation, etc.
It should be clear that the above does not constitute a definitive document. Much more information would have to be supplied before work could start. The defining documents would include a number of pictures showing core formats, pointer conventions, calling conventions, etc. All of the interfaces between the four modules must be specified before work could begin.
This is a modularization in the sense meant by all proponents of modular programming. The system is divided into a number of modules with well-defined interfaces; each one is small enough and simple enough to be thoroughly understood and well programmed. Experiments on a small scale indicate that this is approximately the decomposition which would be proposed by most programmers for the task specified.
Modularization 2
We see the following modules:
Module 1: Line Storage. This module consists of a number of functions or subroutines which provide the means by which the user of the module may call on it. The function call CHAR(r,w,c) will have as value an integer representing the cth character in the rth line, wth word. A call such as SETCHAR(rpv,c,d) will cause the cth character in the wth word of the rth line to be the character represented by d (i.e. CHAR(r,w,c) = d). WORDS(r) returns as value the number of words in line r. There are certain restrictions in the way that these routines may be called; if these restrictions are violated the routines "trap" to an error-handling subroutine which is to be provided by the users of the routine. Additional routines are available which reveal to the caller the number of words in any line, the number of lines currently stored, and the number of characters in any word. Functions DELINE and DELWRD are provided to delete portions of lines which have already been stored. A precise specification of a similar module has been given in [3] and [8] and we will not repeat it here.
剩余5页未读,继续阅读
- 粉丝: 0
- 资源: 4
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Esercizi di informatica!执行计划,metti alla prova!.zip
- Eloquent JavaScript 翻译 - 2ª edição .zip
- Eclipse Paho Java MQTT 客户端库 Paho 是一个 Eclipse IoT 项目 .zip
- disconf 的 Java 应用程序.zip
- cloud.google.com 上使用的 Java 和 Kotlin 代码示例.zip
- 未命名3(3).cpp
- fluent 流体动力学CFD
- Azure Pipelines 文档引用的示例 Java 应用程序.zip
- Apereo Java CAS 客户端.zip
- RAW文件的打开方法与专业处理工具推荐