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 form the vocabulary of your system, you must also model how these things stand in relation to one another.

在你构建抽象事物的时候,将会发现你的类很少独立存在.取而代之的是它们中的大多数有很多方式与其它的类交互.因此,当你为某个系统建模时,不仅要从你的系统词汇表中识别事物,还要为这些事物之间的关联建模.

In object-oriented modeling, there are three kinds of relationships that are especially important: 
dependencies,which represent using relationships among classes (including refinement, trace, and bind relationships ); generalizations, which link generalized classes to their specializations; and associations, which represent structural relationships among objects. Each of these relationships provides a different way of combining your abstractions.

在面向对象建模里,有三类关联特别重要:依赖,它代表的是类之间的使用关系(包括完善,跟踪和绑定关系);通用,将广义类专门化;聚合,代表对象之间的结构关系.这些关联为抽象事物提供了不同的连接方式.

Building webs of relationships is not unlike creating a balanced distribution of responsibilities among your classes. Over-engineer, and you’ll end
up with a tangled mess of relationships that make your model  incomprehensible, under-engineer, and you’ll have missed a lot of the richness of your system embodied  in the way things collaborate.

给关联网建模不同于在类之间创建平衡的职责分配.多余的设计使得关系犹如一团乱麻般,使你的模型难于理解;设计不足你又会错过很多富于表现系统交互的方式.

时间: 2024-10-12 09:20:20

UML基本架构建模--关联概述的相关文章

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基本架构建模--获取类

 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基本架构建模--通用机制的术语和概念(四)

 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基本架构建模--获得通用机制

 Sometimes you just have to color outside the lines. For example, at a job site, an architect might scribble a few notes on the building's blueprints to communicate a subtle detail to the construction workers. In a recording studio, a composer migh

UML基本架构建模--关联的术语和概念(一)

 A relationship is a connection among things. In object-oriented modeling, the three most important relationships are dependencies, generalizations, and associations. Graphically, a relationship is rendered as a path, with different kinds of lines

UML基本架构建模--关联的术语和概念(二)

 Associations 联合 An association is a structural relationship that specifies that objects of one thing are connected to objects of another. Given an association connecting two classes, you can relate objects of one class to objects of the other clas

UML基本架构建模--关联的术语和概念(三)

 Other Features 其它特征 Plain, unadorned dependencies, generalizations, and associations with names, multiplicities, and roles are the most common features you'll need when creating abstractions. In fact, for most of the models you build, the basic fo

UML基本架构建模--图概述

 DIAGRAMS 图群 When you model something, you create a simplification of reality so that you can better understand the system you are developing. Using the UML, you build your models from basic building blocks, such as classes, interfaces, collaborati

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