【正文】
NewTaskBody獨立線程。這一導出關系不一定非要用算法來描述,可以完全人為決定,因此細化關系可描述的語義范圍較廣,包括:模型的逐步細化、優(yōu)化、變換、模板、模型合成、框架組成等等。 ? 使用關系 表示一個元素為了實現(xiàn)或完成其全部的功能需要其它元素或元素集合的配合,例如類與類之間的多種方法調用關系。這些元素間并沒有任何特定的映射關系,關系的方向可被忽略。 mutual exclusion is supplied by the class. 參數(shù)化和實例化類 ? Parameterized/Instantiated Class ? C++ Template TTemplateClassInstantiatedClassUtility Class ClassUtilityInstantiatedClassUtilityTParameterizedClassUtility關系 ? Association – Aggregation – Composition ? Dependency ? Realization ? Generalization (inheritance) Professor UniversityEmployeeEmployerRealization ClassInterfaceSubsystemsubsystemUse Case(from Use Case View)Use Case RealizationComponentInterface聚合關系 ? Aggregation: A special form of association that models a wholepart relationship between an aggregate (the whole) and its parts. Student Schedule合成關系 ? Composition: A form of aggregation with strong ownership and coincident liftimes. The parts cannot survive the whole/aggregate. Student ScheduleAssociation ? 關聯(lián)類 Multiplicity ? 關系的多重性 ? Exactly One: 1 ? Zero or more: 0..n ? One or more: 1..n ? Zero or one: 0..1 ? Specified range: 2..4 ? Multiple, disjoint ranges: 2,4..6 Generalization ? inheritance FlyingThing AnimalAirplane Helicopter Bird Wolf HorseDependency ? A dependency indicates a semantic relationship between two (or more) model elements. It relates the model elements themselves and does not require a set of instances for its meaning. It indicates a situation in which a change to the target element may require a change to the source element in the dependency. 依賴關系 ? bind – Binding: A binding of template parameters to actual values to create a nonparameterized element. ? trace – Trace: A historical connection between two elements that represent the same concept at different levels of meaning. ? refine – Refinement: A historical or derivation connection between two elements with a mapping (not necessarily plete) between them. 依賴關系 ? use – Usage: A situation in which one element requires the presence of another element for its correct implementation or functioning. May be stereotyped further to indicate the exact nature of the dependency, such as calling an operation of another class, granting permission for access, instantiating an object of another class, etc. Maps into a Usage. If the keyword is one of the stereotypes of Usage (call, create, instantiate, send) then it maps into a Usage with the given stereotype. 依賴關系 ? derive – Derivation A putable relationship between one element and another (one more than one of each). ? access The granting of permission for one package to reference the public elements owned by another package (subject to appropriate visibility). Maps into a Permission with the stereotype access. ? import The granting of permission for one package to reference the public elements of another package, together with adding the names of the public elements of the supplier package to the client package. Maps into a Permission with the stereotype import. 四種 UML依賴關系異同 ? 綁定關系 位于模板(如 C++模板)和用其生成的模型元素之間,該元素完全是模板的實例化,為添加任何新的東西。 4) Use Case是對系統(tǒng)行為的動態(tài)描述,它是 OO設計的起點,是類、對象、操作的來源,而通過邏輯視圖的設計,可以獲得軟件的靜態(tài)結構。 3) Actor不是指人,而是指代表某一種特定功能的角色,因此同一個人可能對應很多個 Actor。 2) Use Case View與 Logical View應該由明確的相關性。 ? 定義了“系統(tǒng)邊界”。 ? 生成對象類的動、靜態(tài)模型(解決域)。 ? 生成業(yè)務對象的動、靜態(tài)模型和抽象類。 另外在電信界,用有限自動狀態(tài)機的 SDL方法仍占絕大數(shù),但現(xiàn)在 UML和 SDL出現(xiàn)了融合的趨勢。OO方法、 RUP與 UML建模 首席軟件專家 張恂 博訊科技(上海)有限公司 浩方科技集團 主要內容 一、 OOAD與 UML表示法 二、 RUP建模過程與步驟 三、討論 一、 OOAD與 UML表示法 OO原則 ? Abstraction(抽象) ? Encapsulation(封裝) ? Modularity(模塊化) ? Hierarchy(分層) OO三要素 ? 封裝 ? 繼承 ? 多態(tài) OO基本概念 ? 對象 ? 類 ? 屬性 ? 操作(方法) ? 接口(多態(tài)) * ? 構件 * ? 關系 ? 包 ? 子系統(tǒng) * 接口與多態(tài) ? Polymorphism: The ability to hide many different implementations behind a single interface. ? Interfaces formalize polymorphism, support “plugandplay” architectures. 接口與多態(tài) ShapeTubePyramidCubeShapeDraw()Move()Scale()Rotate()InterfaceTubePyramidCubeComponent ? A nontrivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a welldefined architecture. ? source code ponent, run time ponents, executable ponent Subsystem ? A bination of a package (can contain other model elements) and a class (has behavior) ? Realizes one or more interfaces which define its behavior. Subsystem NamesubsystemInterfaceOOAD是主流技術 OOAD大部分情況下比結構化設計好: 結構化設計是過時的東西,它強調軟件的結構按照功能來組織,一旦功能改變,軟件的結構就會不穩(wěn)定。 而 OO設計把數(shù)據(jù)流和功能統(tǒng)一起來, IT行業(yè)絕大部分( 7080%)的軟件設計(包括數(shù)據(jù)庫設計)可以采用OO方法,目前國外流行的趨勢也是這樣,剩下的少部分有特定需求的可能還會用傳統(tǒng)方法。 Object Oriented Analysis ? 用面向對象方法分析問題域,建立基于對象、消息的業(yè)務模型,形成對客觀世界和業(yè)務本身的正確認識。 Object Oriented Design ? 針對 OOA給出的問題域模型,用面向對象方法設計出軟件基礎架構(概要設計)和完整的類結構(詳細設計),以實現(xiàn)業(yè)務功能。 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 – Nonfunctional requirements – A large model “4+1”視圖 ? Use Case View (Enduser: 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, munication) UML圖示 ? Use Case Diagram ? Sequence Diagram ? Class Diagram ? Collaboration Digram ? State Diagram ? Activity Diagram ? Component Diagram ? Deplo