UML基本架构建模--关联的通用建模技术(一)



Modeling Simple Dependencies

建模简单的依赖

A common kind of dependency relationship is the connection between a class that uses another class as a parameter to an operation.

To model this using relationship,

lCreate a dependency pointing from the class with
the operation to the class used as a parameter in the operation.

普通的依赖关系是一个类与另一个被它作为自身参数的类之间的连接.

建模这个使用的关系,

l创建一个依赖,从带有操作的类指向在操作中被作为参数的类.

For example, Figure 5-9 shows a set of classes drawn from a system that manages the assignment of students and instructors to courses in a university. This figure shows a dependency
from CourseSchedule to
Course , because
Course is used in both the
add
and
remove
operations of
CourseSchedule 
.例如,在图5-9中显示的一组类,它们来自在大学里分配学生和老师课程的管理系统.这个图显示出一个从课程表到课程的依赖,因为课程在课程表中的新增和移除两个操作中都被使用到.

If you provide the full signature of the operation as in this figure, you don’t
normally need to show the dependency as well, because the use of the class is already explicit in the signature. However, you’ll
want to show this dependency sometimes, especially if you’ve elided operation signatures or if your model shows
other relationships to the used class.

如果你在这个图中规定了此操作的所有特征,通常不需要显示这个依赖,因为类的使用特征已经很清晰.然而,你有时会想显示这个依赖,尤其是如果你已经删除了操作的特征或是如果你的模型显示其它关系所使用的类.

.

This figure shows one other dependency, this one not involving classes in operations but rather modeling a common C++ idiom. The dependency from
Iterator
shows that the
Iterator
uses the
CourseSchedule ; the
CourseSchedule knows nothing about the
Iterator
. The dependency is marked with the stereotype <permit>,
which is similar to the friend
statement in C++.

这个图还显示了另一个依赖,类的操作没有涉及这个依赖,这是C++建模的常用习惯.这个依赖来自迭代器,表述的是迭代器使用课程表;课程表对迭代器一无所知.这个依赖被模式化<许可>所标记,这类似于C++里的友元声明.

时间: 2024-08-08 01:29:25

UML基本架构建模--关联的通用建模技术(一)的相关文章

UML基本架构建模--关联的通用建模技术(三)

 Modeling Structural Relationships 建模结构关系 When you model with dependencies or generalization relationships, you may be modeling classes that represent different levels of importance or different levels of abstraction. Given a dependency between two

UML基本架构建模--通用机制的术语和概念(四)

 Constraints 约束 Everything in the UML has its own semantics. Generalization (usually, if you know what's good for you) implies the LisKov substitution principle, and multiple associations connected to one class denote distinct relationships. With c

UML基本架构建模--获取类

 Getting Started 开始 Modeling a system involves identifying the things that are important to your particular view. These things form the vocabulary of the system you are modeling. For example, if you are building a house, things like walls, doors, w

UML基本架构建模--类的辅助信息

 Organizing Attributes and Operations 组织属性和操作 When drawing a class, you don't have to show every attribute and every operation at once. In fact, in most cases, you can't (there are too many of them to put in one figure) and you probably should not

微服务架构下静态数据通用缓存机制

在分布式系统中,特别是最近很火的微服务架构下,有没有或者能不能总结出一个业务静态数据的通用缓存处理机制或方案,这篇文章将结合一些实际的研发经验,尝试理清其中存在的关键问题以及探寻通用的解决之道. 什么是静态数据 这里静态数据是指不经常发生变化或者变化频率比较低的数据,比如车型库.用户基本信息.车辆基本信息等,车型库这种可能每个月会更新一次,用户和车辆基本信息的变化来源于用户注册.修改,这个操作的频率相对也是比较低的. 另外这类数据的另一个特点是要求准确率和实时性都比较高,不能出现丢失.错误,以及

UML图 依赖、关联、聚合、组合

UML,全称:Unified Modeing Language,关于UML的历史和详细描述可以参考<UML参考手册>.UML主要是由一些视图组成,包括静态视图(static view),用例视图(use case view),活动视图(Active view).对于开发人员来说,更重要的是静态视图里面的类图(class view)和交互视图中的顺序视图(sequence diagram). 类图可以帮助我们了解一个系统的结构,而类图除了需要描述单独的类名称.属性和操作外,我们还需要描述类之间的

UML基本架构建模--通用机制的通用建模技术(三)

 Modeling New Semantics 新语义建模 When you create a model using UML, you work within the rules the UML lays down. That's a good thing, because it means that you can communicate your intent without ambiguity to anyone else who knows how to read the UML.

UML基本架构建模--通用机制的术语和概念(三

 Stereotypes 模式化 The UML provides a language for structural things, behavioral things, grouping things, and notational things. These four basic kinds of things address the overwhelming majority of the systems you'll need to model. However, sometime

UML基本架构建模--关联概述

Relationships 关联 When you build abstractions, you'll discover that very few of your classes stand alone. Instead, most of them collaborate with others in a number of ways. Therefore, when you model a system, not only must you identify the things that