美文网首页Engineering
[UML] 类之间的关系

[UML] 类之间的关系

作者: 何幻 | 来源:发表于2017-02-07 16:54 被阅读5次

Graphic paths (P148)



1. Aggregation & Composition: AggregationKind(P39)

AggregationKind is an enumeration type that specifies the literals for defining the kind of aggregation of a property.

AggregationKind is an enumeration of the following literal values:
(1)none:Indicates that the property has no aggregation.
(2)shared:Indicates that the property has a shared aggregation.
(3)composite:Indicates that the property is aggregated compositely, i.e., the composite object has responsibility for the existence and storage of the composed objects (parts).

2. Association(P40)

An association describes a set of tuples whose values refer to typed instances. An instance of an association is called a link. A link is a tuple with one value for each end of the association, where each value is an instance of the type of the end.

An association specifies a semantic relationship that can occur between typed instances. It has at least two ends represented by properties, each of which is connected to the type of the end. More than one end of the association may have the same type.

An association may represent a composite aggregation (i.e., a whole/part relationship). Only binary associations can be aggregations. Composite aggregation is a strong form of aggregation that requires a part instance be included in at most one composite at a time. If a composite is deleted, all of its parts are normally deleted with it. Note that a part can (where allowed) be removed from a composite before the composite is deleted, and thus not be deleted as part of the composite.

Compositions may be linked in a DAG (directed acyclic graph) with transitive deletion characteristics; that is, deleting an element in one part of the graph will also result in the deletion of all elements of the subgraph below that element.

3. Dependency(P65)

A dependency is a relationship that signifies that a single or a set of model elements requires other model elements for their specification or implementation. This means that the complete semantics of the depending elements is either semantically or structurally dependent on the definition of the supplier element(s).

A dependency signifies a supplier/client relationship between model elements where the modification of the supplier may impact the client model elements. A dependency implies the semantics of the client is not complete without the supplier.

The presence of dependency relationships in a model does not have any runtime semantics implications, it is all given in terms of the model-elements that participate in the relationship, not in terms of their instances.

4. Generalization(P75)

A generalization is a taxonomic relationship between a more general classifier and a more specific classifier. Each instance of the specific classifier is also an indirect instance of the general classifier. Thus, the specific classifier inherits the features of the more general classifier.

A generalization relates a specific classifier to a more general classifier, and is owned by the specific classifier.

Where a generalization relates a specific classifier to a general classifier, each instance of the specific classifier is also an instance of the general classifier. Therefore, features specified for instances of the general classifier are implicitly specified for instances of the specific classifier. Any constraint applying to instances of the general classifier also applies to instances of the specific classifier.


Association vs Dependency

An association almost always implies that one object has the other object as a field/property/attribute (terminology differs). A dependency typically (but not always) implies that an object accepts another object as a method parameter, instantiates, or uses another object. A dependency is very much implied by an association. ——Difference between association and dependency?


参考

Object Management Group Unified Modeling Language, Superstructure

相关文章

  • java中类与类之间的几种关系

    通常我们都会使用UML图来表示类与类之间的关系。在这里介绍基本的UML画法,并用UML图类表示类之间的关系。 UM...

  • UML类图

    UML类图帮助我们标明类之间的关系,而在学习UML类图之前,得先理清类与类之间的关系。类的关系有泛化(Genera...

  • UML类图

    转:UML各种关系符号UML类图感知 UML中描述 对象 / 类 之间相互关系的方式包括:依赖(继承,实现),关联...

  • Java自学-接口与继承 UML图

    UML 图 步骤 1 : UML 图 —— 类之间的关系 UML-Unified Module Language统...

  • 软件构造之【设计模式篇】基础知识

    一. UML UML中的类图及类图之间的关系 访问上面的链接,掌握以下知识: 1.类、接口、类图 2.类之间的关系...

  • UML

    UML类图 类之间的关系 泛化关系(generalization) 类的继承结构表现在UML中为:泛化(gener...

  • UML类图学习

    UML类图符号 各种关系说明 UML类图用来描述对象和类之间相互关系的方式 泛化(Generalization):...

  • 设计模式-UML关系基础

    设计模式-UML关系基础UML关系基础 类之间的关系 泛化 类在继承中表现为泛化和实现。继承关系为is-a的关系,...

  • UML类图知识整理

    UML类图 UML,进阶必备专业技能,看不懂UML就会看不懂那些优秀的资料。 这里简单整理 类之间的关系 泛化关系...

  • [UML] 类之间的关系

    Graphic paths (P148) 1. Aggregation & Composition: Aggreg...

网友评论

    本文标题:[UML] 类之间的关系

    本文链接:https://www.haomeiwen.com/subject/lcupittx.html