Six relationships in UML diagrams: generalization, implementation, dependency, association, aggregation, and combination

Source: Internet
Author: User

The relationships defined by UML are: generalization, implementation, dependency, association, aggregation, and combination. The closeness of these six relationships is enhanced in turn.

1. Generalization

Concept:Generalization isGeneral and Special,General and specificDescription of the relationship between them. The detailed description is based on the general description and is extended. In a program, it is implemented through an inherited class. For example, a dog is a specific description of an animal. During object-oriented design, a dog is generally designed as a subclass of an animal.

Representation Method:The solid line of the hollow triangle arrow. The Child class points to the parent class.

2. Implementation

Concept:Implementation isClass and InterfaceClass is the implementation of all features and behaviors of the interface. It is generally described through the class implementation interface in the program.

Representation Method:Dotted Line of the hollow triangle arrow to implement class pointing Interface

3. Dependency

Concept:YesUseThe relationship, that is, the implementation of one class requires the assistance of another class, so do not use bidirectional dependency whenever possible, in a program, a method in Class A generally requires an instance of Class B as its parameter or variable, and Class A itself does not need to reference an instance of Class B as its member variable.

Expression method: dotted arrow, Class A points to Class B.

4. Association

Concept: indicates the connection between a class and a class. It makes one class know the attributes and methods of another class. This relationship is more dependent than the contingency of no dependency relationship, and the relationship is not temporary, generally, it is long-term. In a program, associated Class B appears in the form of class attributes in associated Class, it may also be that associated Class A references a global variable of the associated Class B.

Representation Method: solid arrow, Class A points to Class B

5. Aggregation

Concept: a special case of aggregation Association, is a strong association. Aggregation is the relationship between the whole and the individual, that is, the relationship between has-a. the whole and the individual can have their own lifecycles, and some can belong to multiple overall objects, you can also share multiple objects. The clustering and association relationships in programs are consistent and can only be distinguished at the semantic level;

Representation Method: solid arrow with hollow diamond tail (or no arrow), Class A points to Class B


6. Combination

Concept: combination is also a special case of association. A combination is a relationship between the whole and the part, that is, the contains-a relationship, which is stronger than aggregation. The entire lifecycle is the same as that of the entire lifecycle. The combination and association in the program are consistent and can only be distinguished at the semantic level.

Expression method: The Implementation arrow with solid diamond tail (or no arrow), Class A points to Class B

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: 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.