软件工程5综述

上传人:最**** 文档编号:117488318 上传时间:2019-12-05 格式:PPT 页数:32 大小:444.50KB
返回 下载 相关 举报
软件工程5综述_第1页
第1页 / 共32页
软件工程5综述_第2页
第2页 / 共32页
软件工程5综述_第3页
第3页 / 共32页
软件工程5综述_第4页
第4页 / 共32页
软件工程5综述_第5页
第5页 / 共32页
点击查看更多>>
资源描述

《软件工程5综述》由会员分享,可在线阅读,更多相关《软件工程5综述(32页珍藏版)》请在金锄头文库上搜索。

1、第五章 总体设计 (System Design) 开始考虑“How”,但仍属高层设计(确定黑盒关系 ) 1. 过程 1、确定最佳方案: 从DFD出发进行任务分解,不同的划分方法即对 应不同的方案。每个合理的方案应配备下列4份资 料: 系统流程图 组成系统的物理元素清单 成本/效益分析 进度计划 选择最佳方案并制定详细的实现计划(主要技术 详见第十三章) 1. 过程 2、结构设计 模块化思想: 将DFD细化,至每个子功能都明白易懂; 每个模块完成一个子功能;每层模块合成一 个高一级的功能。 主要工具有 System Design Hierarchy及 HIPO图等。 3、数据库设计 (略) 5、

2、文档、审查 4、测试计划 (详见第七章) 2.模块化原理(Modularization) 1、原理: 经验1:E(P1+P2)E(P1)+E(P2) 经验2:P.94 图5.1 成本 成本 / 模块 最小成本区 接口成本 软件总成本 模块数目 2.模块化原理 2、抽象(Abstraction): 忽略细节,分层理解问题,自顶向下层层加 细。 例:开发一个CAD软件,实现一个二维绘图系统的全 部功能,供低级计算机辅助设计使用。 抽象层次I:用问题所处环境的术语来描述这个软件 。 该软件包括一个计算机绘图界面,向绘图 员显示图形,以及一个数字化仪界面,用 以代替绘图板和丁字尺。所有直线、折线 、矩

3、形、圆及曲线的描画、所有的几何计 算、所有的剖面图和辅助视图都可以用这 个CAD软件实现。 2.模块化原理 抽象层次II:任务需求的描述。列出“What” 而不是“How”。 CAD SOFTWARE TASKS: user interaction task; 2-D drawing creation task; graphics display task; drawing file management task; END 2.模块化原理 抽象层次III:程序过程表示。以2-D绘图生成任 务为例: PROCEDURE 2-D drawing creation REPEAT UNTILE (d

4、rawing creation task terminates) DO WHILE (digitizer interaction occurs) Digitizer interface task; DETERMINE drawing request CASE Line: line drawing task; Rectangle: rectangle drawing task; Circle: circle drawing task; END; DO WHILE (keyboard interaction occurs) keyboard interaction task; PROCESS an

5、alysis/computation CASE View: auxiliary view task; Section: cross sectioning task; END; END REPETITION; END PROCEDURE. 2.模块化原理 3、信息隐蔽(Information hiding) The clients of a module know about its services only through its interface; the implementation is hidden from them (hence may change without affec

6、ting the clients). 4、模块独立性(Module independence) 好设计的关键:每个模块完成一个相对独立 的子功能,并且与其它模块间的接口简单。 在这个抽象层次上,给出了初步的过程表示 ,所用的术语都已面向软件,而且模块化的工作 已经开始显露。 2.模块化原理 耦合(Coupling) Great deal of dependenceIndependent Highly coupled Loosely coupled Uncoupled 独立性的度量:耦合(Coupling)&内聚(Cohesion) (Yourdon & Constantine,1978) 2.

7、模块化原理 例1:A访问C的内 部数据或不通过 正常入口而转入C 的内部。 AB CD A: goto C1 C: C1: 独立性由弱到强排列为: 内容耦合(Content Coupling): One module modifies another. 2.模块化原理 例2:部分代码重 叠(常出现在 汇编程序中) B A 例3:一个模块有 多个入口(功能) A: entry 1: entry 2: The least desirable 2.模块化原理 公共耦合 (Common coupling):Data are accessible from a common data store. Gl

8、obal : V1 V2 A: A1=V1+V2 B: V1=B1 Global : V1 V2 A: V1+ B: V2=B1+V1 问题: 公共部分的改动将影响所有调用它的模块; 公共部分的数据存取无法控制; 复杂程度随耦合模块的个数增加而增加。 2.模块化原理 控制耦合(Control coupling):One module passes parameters to control the activity of another module. A B Flag F2 F1 Fn Flag 接口单一, 但仍然影响 被控模块的 内部逻辑。 数据耦合(Data coupling): Onl

9、y data are passed. It is easy to trace data and make changes. The most desirable. 原则:尽量使用数据耦合,少用控制耦合,限 制公共耦合的范围,完全不用内容耦合 。 2.模块化原理 低内聚: 巧合内聚(Coincidental cohesion): Unrelated functions, processes, or data are found in the same module (for convenience). A: Read inputs from disk from tape from 逻辑内聚(Lo

10、gical cohesion):Logically related functions or data are placed in the same module. 例如: 内聚 (Cohesion): The elements of a module are directed to perform the same task. Goal: as cohesive as possible. 2.模块化原理 时间内聚(Temporal cohesion):The functions are related only by the timing involved. 例如:系统的初始化 问题:不同功

11、能混在一个模块中,有时共用部 分编码,使局部功能的修改牵动全局。 中内聚: 过程内聚(Procedural cohesion):Functions are grouped together in a module to ensure a certain order of performance. 例如: enter data check data manipulate data 2.模块化原理 通信内聚(Communicational cohesion):All the functions in a module operate on or produce the same data set.

12、 例如:从同一磁带上读取不相干的数据 可能破 坏独立性。 高内聚: 顺序内聚(Sequential cohesion):The output from one part of a module is the input to the next part. 功能内聚(Functional cohesion):Every processing element is essential to the performance of a single function. 3.启发式规则 2. 模块规模适中: 过大不易理解;太小则接口开销过大。注意 分解后不应降低模块的独立性。 3. 适当控制 深度 =

13、分层的层数。过大表示分工过细。 宽度 = 同一层上模块数的最大值。过大表 示系统复杂度大。 1. 争取低耦合、高内聚(增加内聚 减少耦合) 3.启发式规则 扇出 = 一个模块直 接调用控制的模块 数。 3 fan-out 9 A A的扇出 A A的扇入 扇入 = 直接调用该模 块的模块数 在不破坏独立性的前提 下,fan-in 大的比较好 。 3.启发式规则 4、作用域在控制域内 控制域 M AC B M的控制域为 M,A,B,C 作用域:M中的一个判定所影响的模块。 例如:A: if then goto B1 B: B1: 作用域在控制域内 A: if then goto M1 M: M1:

14、 goto C1 作用域超出了控制域 上例中A的作用超出了控制域。改进方法之一,可以 把A中的 if 移到M中;方法之二,可以把C移到A下面 。 3.启发式规划 5、降低接口的复杂程度:接口复杂可能表明模 块的独立性差。 6、单出单入,避免内容耦合。 7、模块功能可预测 相同输入必产生相同输 出。反例:模块中使用全局变量或静态变量, 则可能导致不可预测。 4.图形工具 1、Hierarchy和HIPO 例1:P.103 图5.4 例2: Users Interface Find a Room 2.0 Delete a Room 3.0 Enter a New Room 1.0 Establis

15、h a House 4.0 By Type of Floor 2.3 By Square Footage 2.2 By Room ID 2.1 Add a Room 4.1 Find a Room 4.2 Delete a Room 4.3 View House 4.4 By Room ID 4.2.1 4.图形工具 注意: 这里的hierarchy表现软件的结构,而非数据结 构; 每个矩形框代表一个模块,连线表示“调用”而 非“组成”; 所谓HIPO,即对每个模块附一张IPO图。每个 IPO图中应明确标出对应模块的编号。 2、结构图(Structured Diagram) 符号: 数据传递 ; 控制信息 ; 或; 循环. 4.图形工具 例: B A M M1M2M3 C D 注:此图一般 不入文档,仅 用于检查设计 的正确性和模 块独立性。 须检

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号