UML复习
UML复习
1. Package Diagram
Purpose:
• Describes the logical architecture of a system by organizing elements into packages.
• Helps in modularizing and structuring the system.
Key Points:
• Packages: Represent logical groupings of related elements (e.g., classes, interfaces).
• Dependencies: Show relationships between packages, indicating how they interact.
• Logical Architecture: Focuses on the organization of the system rather than its physical implementation.
中英文翻译:
包图
目的:
• 通过将元素组织成包来描述系统的逻辑架构。
• 帮助模块化和结构化系统。
关键点:
• 包: 表示相关元素(例如类、接口)的逻辑分组。
• 依赖关系: 显示包之间的关系,指示它们如何交互。
• 逻辑架构: 关注系统的组织而非其物理实现。
2. OO Core Concepts (Abstraction, Encapsulation, Inheritance, Polymorphism)
Objects:
• Anything that is being studied or modeled in the system.
Classes:
• Templates for objects, defining a group of objects with the same attributes and operations.
Abstraction:
• Focuses on the most essential and intrinsic properties that distinguish an entity from others.
Encapsulation:
• Hides the internal details of an object and exposes only necessary interfaces.
Inheritance:
• Allows a class (child) to inherit attributes and behaviors from another class (parent).
Polymorphism:
• Enables objects of different classes to be treated as objects of a common superclass.
中英文翻译:
面向对象核心理念(抽象、封装、继承、多态)
对象:
• 系统中被研究或建模的任何事物。
类:
• 对象的模板,定义一组具有相同属性和操作的对象。
抽象:
• 关注区分实体的最本质和内在属性。
封装:
• 隐藏对象的内部细节,仅暴露必要的接口。
继承:
• 允许一个类(子类)从另一个类(父类)继承属性和行为。
多态:
• 允许不同类的对象被视为共同超类的对象。
3. UP Process (Unified Process)
Inception Phase:
• Foresees the project scope, vision, and business case.
Elaboration Phase:
• Refines the vision, iteratively implements the core architecture, resolves high risks, and determines most requirements and scope.
Construction Phase:
• Iteratively implements lower-risk and easier elements, preparing for deployment.
Transition Phase:
• Focuses on testing and deployment.
中英文翻译:
统一过程(UP)
初始阶段:
• 预见项目的范围、设想和业务案例。
细化阶段:
• 精化设想,迭代实现核心架构,解决高风险,确定大多数需求和范围。
构造阶段:
• 迭代实现遗留的低风险和较容易的元素,准备部署。
移交阶段:
• 专注于测试和部署。
4. Disciplines and Artifacts
Disciplines:
• A set of activities within a subject area (e.g., business modeling, requirements, design, implementation).
Artifacts:
• Outputs produced during the activities of a discipline (e.g., documents, models, code).
中英文翻译:
科目与制品
科目:
• 主题域内的一组活动(例如,业务建模、需求、设计、实现)。
制品:
• 科目活动过程中产生的产物(例如,文档、模型、代码)。
5. Actor (Use Case Diagram)
Purpose:
• To identify user goals that drive the use cases.
• To clarify external interfaces and protocols.
• To ensure all necessary interests are identified and satisfied.
中英文翻译:
参与者(用例图)
目的:
• 找到驱动用例的用户目标。
• 明确外部接口和协议。
• 确保所有必要的事物都被识别并满足。
6. Domain Model and Use Case Model
Domain Model:
• A visual representation of conceptual classes or real-world objects within a domain.
• Focuses on the problem space, not software classes.
Use Case Model:
• A collection of all use cases.
• Represents the system’s functionality and its environment.
中英文翻译:
领域模型与用例模型
领域模型:
• 领域内概念类或现实世界对象的可视化表示。
• 关注问题空间,而非软件类。
用例模型:
• 所有用例的集合。
• 表示系统的功能及其环境。
7. SD; SSD; Use Case Realization
Sequence Diagram (SD):
• Emphasizes the chronological order of message passing between objects.
System Sequence Diagram (SSD):
• Focuses on interactions between the system and external actors.
Use Case Realization:
• Describes how a use case is implemented in terms of interactions between objects.
中英文翻译:
顺序图;系统顺序图;用例实现
顺序图:
• 强调对象之间消息传递的时间顺序。
系统顺序图:
• 关注系统与外部参与者之间的交互。
用例实现:
• 描述用例如何通过对象之间的交互实现。
8. Communication Diagram vs. Sequence Diagram
Sequence Diagram:
• Focuses on the chronological order of message passing.
Communication Diagram:
• Emphasizes message passing among a group of objects with a specific structure.
Key Difference:
• Same semantics but different representations.
中英文翻译:
通信图与顺序图的区别
顺序图:
• 强调消息传递的时间顺序。
通信图:
• 强调具有特定结构的对象群之间的消息传递。
关键区别:
• 语义相同,但表示方式不同。
9. Controller
Role:
• The first object beyond the UI that receives and coordinates system operations.
Behavior:
• Delegates tasks to other objects to complete the work.
中英文翻译:
控制器
角色:
• 超出用户界面的第一个对象,接收并协调系统操作。
行为:
• 将任务委派给其他对象以完成工作。
其他选项的option:
①外观(当系统操作没那么多时)
②用例控制器(当系统操作多到外观“臃肿”时,每个用例有自己的控制器)
优点:①增加了可复用和接口可插拔[pluggable]的潜力;②获得了推测用例状态的机会。
10. Activity Diagram, Interaction Diagram, Domain Model (Design Class Diagram)
Activity Diagram:
• Represents multiple sequential and parallel activities within a process.
• Focuses on the flow of activities and decision points.
Interaction Diagram:
• Describes interactions between objects through messages.
• Includes Sequence Diagrams and Communication Diagrams.
Domain Model (Design Class Diagram):
• A visual representation of conceptual classes or real-world objects within a domain.
• Focuses on the problem space, not software classes.
中英文翻译:
活动图、交互图、领域模型(设计类图)
活动图:
• 表示一个过程中的多个顺序和并行活动。
• 关注活动的流程和决策点。
交互图:
• 描述对象之间通过消息的交互。
• 包括顺序图和通信图。
领域模型(设计类图):
• 领域内概念类或现实世界对象的可视化表示。
• 关注问题空间,而非软件类。
11. Class Relationships (Multiplicity)
One-to-One (1:1):
• One instance of a class is associated with exactly one instance of another class.
One-to-Many (1:N):
• One instance of a class is associated with multiple instances of another class.
Many-to-Many (N:M):
• Multiple instances of a class are associated with multiple instances of another class.
Zero-to-Many (0:N):
• Zero or more instances of a class are associated with multiple instances of another class.
中英文翻译:
类的关系(多重性)
一对一 (1:1):
• 一个类的实例与另一个类的一个实例相关联。
一对多 (1:N):
• 一个类的实例与另一个类的多个实例相关联。
多对多 (N:M):
• 一个类的多个实例与另一个类的多个实例相关联。
零对多 (0:N):
• 一个类的零个或多个实例与另一个类的多个实例相关联。
12. State Machine Diagram (Chapter 29)
Purpose:
• Represents the behavior of an object over its lifecycle.
• Captures external system events recognized and handled by the system in the context of a use case.
Key Elements:
• States: Represent the condition of an object at a specific point in time.
• Transitions: Represent the movement from one state to another triggered by events.
中英文翻译:
状态机图(第29章)
目的:
• 表示对象在其生命周期内的行为。
• 捕获在用例上下文中由系统识别和处理的外部系统事件。
关键元素:
• 状态: 表示对象在特定时间点的条件。
• 转换: 表示由事件触发的从一个状态到另一个状态的移动。
13. Sequence Diagram
Purpose:
• Represents the inputs and outputs related to the system for a specific scenario.
• Focuses on the chronological order of message passing between objects.
Key Elements:
• Objects: Represented as vertical lifelines.
• Messages: Represented as horizontal arrows between lifelines.
中英文翻译:
顺序图
目的:
• 表示与系统相关的特定场景的输入和输出。
• 关注对象之间消息传递的时间顺序。
关键元素:
• 对象: 表示为垂直的生命线。
• 消息: 表示为生命线之间的水平箭头。
14. Three-Tier Architecture
Purpose:
• Divides the entire business application into three layers for high cohesion and low coupling.
Layers:
- User Interface Layer (Presentation Layer):
• Handles user interaction and displays information. - Business Logic Layer:
• Implements the core functionality and business rules. - Data Access Layer:
• Manages data storage and retrieval.
Disadvantages:
• Increased complexity due to separation of layers.
• Potential performance overhead due to inter-layer communication.
• Requires careful design to maintain separation of concerns.
中英文翻译:
三层架构
目的:
• 将整个业务应用划分为三个层次,以实现高内聚低耦合。
层次:
- 用户界面层(表示层):
• 处理用户交互并显示信息。 - 业务逻辑层:
• 实现核心功能和业务规则。 - 数据访问层:
• 管理数据存储和检索。
缺点:
• 由于层次分离,复杂性增加。
• 由于层间通信,可能存在性能开销。
• 需要精心设计以保持关注点分离。
1. Use Case Driven Design and Implementation (Chapter 6)
Use Case Driven Design:
• Functional requirements are first recorded in use cases, which are a critical part of iterative planning.
• Use cases guide the design and development process by focusing on user goals and system behavior.
Use Case Realization:
• Describes how a use case is implemented in the design model based on collaborating objects.
• Focuses on the interaction between objects to achieve the functionality described in the use case.
中英文翻译:
用例驱动设计与实现(第6章)
用例驱动设计:
• 功能需求首先记录在用例中,用例是迭代计划的重要组成部分。
• 用例通过关注用户目标和系统行为来指导设计和开发过程。
用例实现:
• 描述用例如何基于协作对象在设计模型中实现。
• 关注对象之间的交互以实现用例中描述的功能。
2. SSD (System Sequence Diagram) vs. SD (Sequence Diagram) (Chapter 10 & 15)
System Sequence Diagram (SSD):
• Shows interactions between the system and external actors.
• Focuses on the input and output messages at the system boundary.
Sequence Diagram (SD):
• Represents the chronological order of message passing between objects within the system.
• Focuses on the internal behavior and collaboration of objects.
Key Difference:
• SSD: High-level view of system interactions with actors.
• SD: Detailed view of object interactions within the system.
中英文翻译:
系统顺序图(SSD)与顺序图(SD)的区别(第10章和第15章)
系统顺序图(SSD):
• 显示系统与外部参与者之间的交互。
• 关注系统边界的输入和输出消息。
顺序图(SD):
• 表示系统内对象之间消息传递的时间顺序。
• 关注对象的内部行为和协作。
关键区别:
• SSD: 系统与参与者交互的高层次视图。
• SD: 系统内对象交互的详细视图。
3. GRASP Patterns (P245, Figure 18-13 Payment)
Question: Who should create the Payment instance?
Creator Pattern:
• Register: Records the Payment.
• Sale: Frequently uses the Payment.
Information Expert Pattern:
• Register: Has the initialization data (amount of cash received).
Guideline:
• When multiple options exist, analyze cohesion, coupling, and potential future evolution.
Result:
• Sale is chosen to create the Payment.
• Reduces the workload of Register and lowers its coupling by not requiring it to know about Payment’s existence.
中英文翻译:
GRASP模式(P245,图18-13 Payment)
问题: 谁应该创建Payment实例?
创建者模式:
• Register: 记录Payment。
• Sale: 频繁使用Payment。
信息专家模式:
• Register: 拥有其初始化数据(收到的现金数额)。
准则:
• 当存在多个选项时,应深入分析内聚、耦合和未来可能的进化压力。
结果:
• 选择Sale来创建Payment。
• 减轻Register的工作负担,同时降低其耦合性,因为它不需要知道Payment的存在。
4. Protected Variations (PV) (P310)
Purpose:
• To ensure that variations or instability in certain elements do not influence other elements.
Definition:
• Identify points of predicted variation or instability; assign responsibilities to create a stable interface around them.
Measures:
• Hide the design of structures that are likely to change.
• Use interfaces or abstract classes to isolate variations.
Implementation:
• Encapsulate varying behavior behind stable interfaces.
• Use design patterns like Adapter, Strategy, or Bridge to manage variations.
中英文翻译:
防止变异(PV)(P310)
目的:
• 确保某些元素的变化或不稳定性不会影响其他元素。
定义:
• 识别预见到的变化或不稳定之处,分配职责,在这些变化之外创建稳定的接口。
措施:
• 隐藏可能发生变化的结构设计。
• 使用接口或抽象类来隔离变化。
实现:
• 将变化的行为封装在稳定的接口后面。
• 使用设计模式(如适配器、策略或桥接)来管理变化。
5. GRASP vs. GoF
GRASP (General Responsibility Assignment Software Patterns):
• Core idea: Responsibility assignment.
• Focuses on assigning responsibilities to objects during the early stages of object analysis.
GoF (Gang of Four Design Patterns):
• Solves object coupling issues in concrete implementations.
• Applied throughout the entire software design process, with a longer duration of impact.
Key Differences:
- Focus:
• GRASP: Responsibility assignment in early analysis.
• GoF: Object coupling in implementation. - Duration:
• GRASP: Used in the initial stages.
• GoF: Applied throughout the design process.
中英文翻译:
GRASP与GoF的区别
GRASP(通用职责分配软件模式):
• 核心理念:职责分配。
• 关注在对象分析的早期阶段为对象分配职责。
GoF(四人帮设计模式):
• 在具体实现中解决对象耦合问题。
• 在整个软件设计过程中应用,影响时间更长。
关键区别:
- 关注点:
• GRASP:早期分析中的职责分配。
• GoF:实现中的对象耦合。 - 持续时间:
• GRASP:用于初始阶段。
• GoF:应用于整个设计过程。