资源预览内容
第1页 / 共125页
第2页 / 共125页
第3页 / 共125页
第4页 / 共125页
第5页 / 共125页
第6页 / 共125页
第7页 / 共125页
第8页 / 共125页
第9页 / 共125页
第10页 / 共125页
亲,该文档总共125页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
OO方法、RUP与UML建模 首席软件专家张恂 博讯科技(上海)有限公司 浩方科技集团 2000.11 主要内容 一、OOAD与UML表示法 二、RUP建模过程与步骤 三、讨论 一、OOAD与UML表示法 OO原则 Abstraction(抽象) Encapsulation(封装) Modularity(模块化) Hierarchy(分层) OO三要素 封装 继承 多态 OO基本概念 对象 类 属性 操作(方法) 接口(多态)* 构件* 关系 包 子系统* 接口与多态 Polymorphism: The ability to hide many different implementations behind a single interface. Interfaces formalize polymorphism, support “plug-and-play” architectures. 接口与多态 Shape Tube Pyramid Cube Shape Draw() Move() Scale() Rotate() Tube Pyramid Cube Component A non-trivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well- defined architecture. source code component, run time components, executable component Subsystem A combination of a package (can contain other model elements) and a class (has behavior) Realizes one or more interfaces which define its behavior. Subsystem Name Interface OOAD是主流技术 OOAD大部分情况下比结构化设计好: 结构化设计是过时的东西,它强调软件的结构按照功 能来组织,一旦功能改变,软件的结构就会不稳定。 而OO设计把数据流和功能统一起来,IT行业绝大部分 (70-80%)的软件设计(包括数据库设计)可以采用 OO方法,目前国外流行的趋势也是这样,剩下的少部 分有特定需求的可能还会用传统方法。 另外在电信界,用有限自动状态机的SDL方法仍占绝 大数,但现在UML和SDL出现了融合的趋势。 Object Oriented Analysis 用面向对象方法分析问题域,建立基于 对象、消息的业务模型,形成对客观世 界和业务本身的正确认识。 生成业务对象的动、静态模型和抽象类。 Object Oriented Design 针对OOA给出的问题域模型,用面向对 象方法设计出软件基础架构(概要设计) 和完整的类结构(详细设计),以实现 业务功能。 生成对象类的动、静态模型(解决域)。 Analysis vs. Design Analysis Focus on understanding the problem Idealized design Behavior System Structure Functional requirements A small model Design Focus on understanding the solution Operations and Attributes Performance Close to real code Object lifecycles Non-functional requirements A large model “4+1”视图 Use Case View (End-user: Functionality) Logical View (Analysts/Designers: Structure) Process View (System integrators: Performance, Scalability, Throughput) Implementation View (Programmers:Software management) Deployment View (System engineering: System Topology, Delivery, installation, communication) UML图示 Use Case Diagram Sequence Diagram Class Diagram Collaboration Digram State Diagram Activity Diagram Component Diagram Deployment Diagram Actor - 用户 “An Actor defines a coherent set of roles that users of use cases play when interacting with use cases. An actor has one role for each use case with which it communicates.” 角色的集合,可以是人或外部系统。 定义了“系统边界”。 Actor Use Case - 用例 The specification of a sequence of actions, including variants, that a system (or other entity) can perform, interacting with actors of the system. A use case is a coherent unit of functionality provided by a system, a subsystem, or a class as manifested by sequences of messages exchanged among the system and one or more outside interactors (called actors) together with actions performed by the system. Use Case Business Use Case/Actor Business Actor Business UseCase Business - System 例子 登 录 系统 登 记 员 完成课程 登 记 计费系统 学 生 登 记 课程 教授 选择 教授 课程 课程 目 录 系统 课程登记系统 下订 单 销售 员 检查订 货状况 管理员 发货员 填 订 单 客户 建 立 信 用 纪录 电话定购 系 统 Use Case依赖关系 Association The participation of an actor in a use case, i.e. instances of the actor and instances of the use case communicate with each other. This is the only relationship between actors and use cases. Extend An extend relationship from use case A to use case B indicates that an instance of use case B may be extended (subject to specific conditions specified in the extension) by the behavior specified by A. The behavior is inserted at the location defined by the extension point in B which is referenced by the extend relationship. Use Case依赖关系 Generalization A generalization from use case A to use case B indicates that A is a specialization of B. Include An include relationship from use case A to use case B indicates that an instance of the use case A will also include the behavior as specified by B. The behavior is included at the location which defined in A. 销售 员 下订 单 提供客户数 据定购 产品安 排 付款 调阅 产品 目 录 产品定购管理 Actor Generalization 下订 单 销售 员 管理员 建 立 信 用 纪录 Sequence Diagram A diagram that shows object interactions arranged in time sequence. In particular, it shows the objects participating in the interaction and the sequence of messages exchanged. Unlike a collaboration diagram, a sequence diagram includes time sequences but does not include object relationships. A sequence diagram can exist in a generic form (describes all possible scenarios) and in an instance form (describes one actual scenario). Sequence diagrams and collaboration diagrams express similar information, but show it in different ways. 序列图元素 Joe : Customer Banking Screen : AccountForm Use Case描述 简述: This use case allows a Student to register for course offering in the current semester. The Student can also update or delete course selections if changes are made within the add/drop period at the beginning of the semester. The Course Catalog System provides a list of all the course offerings for the current semester. 登 记 课程 事件流 Basic Flow: This use case start when
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号