Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How UML uses associated symbols

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how UML uses associated symbols, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

UML associated symbol

UML divides the relationships between classes into the following five categories.

◆ association: there is a specific correspondence between the instances of class An and class B.

◆ dependency: class An accesses services provided by class B

◆ aggregation: class An is the whole class, class B is the local class, and the objects of class An are composed of the objects of class B.

◆ generalization: class An inherits class B

◆ implementation: class An implements the B interface

UML Association (Association)

Associations refer to specific correspondence between classes, represented by arrows with solid lines in UML. According to the quantity comparison between classes, the association

It can be divided into the following three categories:

◆ one-to-one association

◆ one-to-many association

◆ many-to-many association

Note: Association should be divided into one-way association and two-way association.

Dependency (Dependency)

Dependencies refer to the invocation relationships between classes, represented by arrows with dotted lines in UML. If class An accesses the properties or methods of class B

Or class An is responsible for instantiating class B, then it can be said that class A depends on class B. Unlike association relationships, there is no need to define attributes of class B type in class A.

Aggregation (Aggregation)

Aggregation in the UML association symbol refers to the relationship between the whole and the part, which is represented by a diamond arrow with a solid line in UML.

Aggregation relationships can also be divided into two types:

Subsystems where ◆ is aggregated are allowed to be dismantled and replaced, which is a normal aggregation relationship.

The subsystem where ◆ is aggregated is not allowed to be disassembled and replaced. This aggregation is called strong aggregation relationship, or component relationship.

Note: strong aggregation (composition) can be indicated by a solid diamond arrow with solid lines.

Generalization (Generalization)

Generalization refers to the inheritance relationship between classes, represented by triangular arrows with solid lines in UML.

Implement (Realization)

The implementation in the UML association symbol refers to the relationship between the class and the interface, which is represented by triangular arrows with dashed lines in UML.

The following is the description in the GOF design pattern:

Arrows and triangles represent subclass relationships.

The dummy arrow line indicates that one class instantiates an object of another class, and the arrow points to the class of the instantiated object.

The ordinary arrow line indicates acquaintance (acquaintance is also called UML association or reference), which means that one object only knows another object. Acquainted objects may request each other's operations, but they are not responsible for each other, it only indicates the loosely coupled relationship between objects.

An arrow line with a diamond at the tail indicates aggregation, meaning that one object owns another object or is responsible for another object. We generally say that an object contains another object, or is part of another object. Aggregation means that the aggregate object has the same lifecycle as its owner.

Abstract class names are represented in italics, and abstract operations are represented in italics. The figure can include pseudo-code to implement the operation, and the code will appear in the box with pleated corners, and use dotted lines to connect the pleated corner box to the operation implemented by the code.

I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report