Symbols in a UML diagram

Source: Internet
Author: User

Http://blog.sina.com.cn/s/blog_640e6f8d0100gbkt.html

Relationships between classes

UML classifies the relationships between classes into the following five types.

● Association: there is a specific correspondence between instances of Class A and Class B.

● Dependency: services provided by Class A and Class B

● Aggregation: Class A is the overall Class, Class B is the local class, and Class A objects are composed of Class B objects.

● Generalization: Class A inherits Class B

● Implementation: Class A implements the B Interface

Association)

Association refers to the specific correspondence between classes, which is expressed by arrows with solid lines in UML. Compare and associate classes by quantity

There are three types:

● One-to-one Association

● One-to-Multiple Association

● Multiple-to-Multiple Association

Note: The Association can also be divided into one-way Association and two-way Association.

Dependency)

Dependency refers to the call relationship between classes, which is expressed by arrows with dotted lines in UML. If the Class A contains the attributes or methods of Class B,

Or Class A is responsible for instantiating Class B, so Class A depends on Class B. Unlike associations, you do not need to define B-type attributes in Class.

Aggregation)

Clustering refers to the relationship between the whole and the part, which is expressed by a diamond arrow with solid lines in UML.

Clustering can also be divided into two types:

● The clustered subsystem can be disassembled and replaced. This is a common clustering relationship.

● The clustered subsystem cannot be disassembled or replaced. Such aggregation is called a strong Clustering or composition relationship.

Note: strong aggregation (composition) can be expressed by solid diamond arrows with solid cables.

Generalization)

Generalization refers to the inheritance relationship between classes. In UML, it is represented by a triangle arrow with a solid line.

Implementation)

Implementation refers to the relationship between classes and interfaces. In UML, a triangular arrow with a dotted line is used.

The following describes the gof design patterns:

Arrow and triangle indicate the Child class relationship.

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

A normal arrow line indicates an acquaintance (acquaintance is also called an association or reference), meaning that an object only knows another object. Familiar objects may request mutual operations, but they are not responsible for each other. They only indicate loose coupling between objects.

An arrow line with a rhombus at the end indicates aggregation, which means that an object has another object or is responsible for another object. Generally, an object contains another object or a part of another object. Aggregation means that the aggregate object has the same lifecycle as its owner.  
         Abstract class names are in italic, and abstract operations are also in italic. The figure can include the operation pseudoCode, The code will appear in the box with a pleat, and use the dotted line to connect the pleat box with the operations implemented by the Code.

 

 

 

Figure 1:

 

This solid line arrow indicates,InheritanceIs inherited from a non-interface class.

Figure 2:

The line representsBidirectional Association:
On the left side, flight plays the role assignedfights, with 0 to 1 plane associated with him (a flight can either be canceled, no plane, or only correspond to one plane)
On the right side, plane plays the role of assignedplane, with 0 to multiple flight associated with him (one plane can participate in multiple flights or stop in the warehouse and rot)

Figure 3:

The line representsUnidirectional Association:
The basic meaning is the same as above. The only difference is that the class on the right has no idea about the class on the left.

Figure 4:

The large circle is calledSoftware Package, The name is account, and some classes that can be classified are packaged.

Figure 5:

Such a dotted arrow indicates implementingInterface.

Figure 6:

The horizontal line still indicates the association mentioned above, but the dotted line extended from the association line, which means that when an instance of the flight class is associated with an instance of the frequentflyer class,An instance of the mileagecredit class will be generated..

Figure 7:

The arrow with a diamond represents the basic aggregation. From the knowledge, the wheel class assumes the role of the wheels and aggregates four to the car object,
The hollow diamond indicates that the wheel object is not created and destroyed with the creation of the car..

Figure 8:

The meaning is similar to the above. The only difference is that,Solid diamond indicates that the Department object is created and destroyed with the creation of the company object..

Figure 9:

IndicatesReflection AssociationShows how an employee class is associated with it through the manager/manages role. When a class is associated with itself, this does not mean that the instance of the class is related to itself, but an instance of the class is related to another instance of the class.

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.