Four types of UML relationships

Source: Internet
Author: User

In general, UML is actually four types of relationships and nine types of diagrams. Therefore, for UML syntax alone, it is very easy to grasp. The difficulty of UML is application. Different people have different opinions on the same system. However, a long-term process is required to ensure that the code written is basically the same as the image. You can draw a picture instead of understanding it. The following briefly summarizes the four relationships:

In UML, there are four relationships: Association, dependency, generalization, and implementation.

1. Association:

Associations can be divided into common associations, aggregation, and combination.

1. Common Association

Common associations are divided into one-way associations (navigation associations) and two-way associations. In addition, there can be multiple associations between the two classes. One class can also have multiple class associations and be associated with itself.

                                                                                                                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                                                                                                                          


2. Aggregation

Aggregation is a special association. She represents the whole-part of the relationship. It is represented by a hollow diamond. The diamond points to the whole. The overall and partial coupling is loose.

3. Combination

A combination is also a special association. It is also the overall and part. However, the coupling between the overall and part expressed by the combination is relatively tight, and the part will not be created before the topic is created. Represented by solid diamond

 

Ii. Dependency

Dependency is a usage relationship. It indicates that the change in the specification of one thing may affect the use of another thing, but the opposite is not necessarily. It is represented by-->.

Iii. Generalization

A general relationship is a kind of "is-a-kind-of" relationship, that is, inheritance.

1. Single inheritance

That is, a subclass has only one parent class, for example

2. Multi-Inheritance

A class has two or more parent classes, for example

IV. Implementation

The semantic relationship between class elements during implementation. In this relationship, the contract for implementation of another class element is described with various plans.

The above are the four relationships in UML. When drawing a UML diagram, the application of the association relationship must be detailed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.