The explanation of diagrams in UML

Source: Internet
Author: User

Recently teaching software engineering project practice, and carefully understand the next UML in the meaning of the various relationships, although a bit simple, but some concepts are often confused, written here is to deepen the impression.

Closed Series Table:

Inheritance relationship (generalization);

Implementation Relationship (realization);

Dependency Relationship (Dependency);

Association relationship (Association);

A directional Association (directedassociation);

Aggregation relationship (Aggregation);

Combined relationship (composition);

Inheritance relationship (generalization):

Class B inherits from class A

Inheritance refers to the ability of a class (called a subclass, sub-interface) to inherit the functionality of another class (called the parent class, the parent interface) and to augment its own new functionality, which is one of the most common relationships between classes and classes or interfaces and interfaces; in Java , such relationships pass the keyword extends clearly identified, in the design of the general non-controversial;

Implementation relationship (realization):

Class a implements the Interface a

Implementation is a class class that implements the interface interface (which can be multiple), and implementation is one of the most common relationships between classes and interfaces; in Java These relationships are clearly identified by the keyword implements and are generally not controversial at design time;

Dependency relationship (Dependency):

ClassA relies on ClassB

a using another class b ; expressed at the code level, for class Span style= "Font-family:times New Roman;" >b as parameter is class a in a method used;

Association Relationship (Association):

ClassA and ClassB are interrelated

The relationship between the two is relatively thin, the correlation and the direction of the association is separated from each other, he embodies the two classes, or classes and interfaces a strong dependency on the semantic level, is a long-term stable relationship; At the code level, the associated class appears in the association class as a class attribute, It is also possible that the Association class refers to a global variable of the type being associated with the class;

A directional Association (directedassociation):

ClassA related to ClassB

is a particular form of association, one-way, and at the level of the code, in the form of a class attribute of the associated class B in the Association class a or an association class a Refers to a global variable of type B that is associated with the class;

Aggregation relationship (Aggregation):

Computer has-a CPU

Aggregation is a special case of association relationship, he embodies the whole and part, the relationship, that is, the relationship between the has-a , the whole and the part is separable, they can have their own life cycle, some can belong to multiple whole objects, can also be shared for multiple whole objects , such as computer and CPU,behave at the code level, and the association is consistent, can only be differentiated from the semantic level;

Composition relationship (composition):

Pregnant contains-a Fetus

The combination is also a special case of the relationship, he embodies a contains-a relationship, which is stronger than aggregation, also known as strong aggregation, he also embodies the relationship between the whole and part, but at this time the whole and part is not divided, The end of the whole life cycle also means that part of the life cycle is over; the fetus is dead when the pregnant woman dies; at the code level, the relationship is consistent and can only be differentiated from the semantic level;

The explanation of diagrams in UML

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.