Parse the meaning of UML arrows and lines (go)

Source: Internet
Author: User

In the process of learning UML, you often encounter UML class diagram relationship, here to introduce you to the UML arrows, lines represent the meaning, I believe that through the introduction of this article you have a more explicit understanding of the meaning of arrows and lines in UML.

AD:

This section to learn about UML arrows, lines represent the meaning of UML, the relationship is mainly dependent, aggregation, synthesis, generalization and implementation, and so on, let's look at how these relationships are implemented with UML arrows and lines.

UML arrows, line programs

Relationship

The following example will show the relationships independently for a specific purpose. Although grammatically correct, these examples can be further refined to include more semantics within their valid range.

Dependency (Dependency)

A "use" relationship between entities implies that the specification of an entity changes and may affect other instances that depend on it (Figure D). More specifically, it can be converted to any type of reference to a class or object that is not within the scope of the instance. This includes a local variable, a reference to an object obtained through a method invocation (as shown in the following example), or a reference to a static method of a class (without an instance of that class). You can also use dependencies to represent the relationship between packages and packages. Because the package contains classes, you can represent the relationship between packages and packages based on the relationships between the classes in those packages.

Figure D

Mb+a?u Association (Association)

A structured relationship between entities indicates that objects are interconnected. The UML arrows are optional and are used to specify navigation capabilities. If there are no arrows, hinting is a two-way navigation capability. In Java, the Association (Figure E) is converted into a variable of an instance scope, just as the code shown in the Java area of Figure E. Additional modifiers can be attached to an association. The multiplicity (multiplicity) modifier implies a relationship between instances. In the model code, an employee can have 0 or more timecard objects. However, each timecard only belongs to a single employee.

Figure E

Aggregation (Aggregation)

Aggregation (Figure F) is a form of association, and a UML arrow represents a global/local relationship between two classes. Aggregation implies that the whole is conceptually at a higher level than the local, and the association implies that two classes are conceptually at the same level. Aggregations are also converted to an instance-scoped variable in java. 7MIrrhk
Yc7lr#n8j0
The difference between association and aggregation is purely conceptual, and is strictly reflected in semantics. Aggregation also implies that there are no loops in the instance diagram. In other words, it can only be a one-way relationship.

Figure F

Synthesis (composition)

Synthesis (Figure G) is a special form of aggregation, and the UML arrows imply "local" lifetime responsibilities within the "whole". The composition is also unshared. Therefore, although the local does not have to be destroyed with the overall destruction, but the overall responsibility to maintain a local survival, or be responsible for destroying it. Local cannot be shared with other whole. However, the whole can transfer ownership to another object, which will then assume the lifetime responsibility.

The relationship between employee and timecard may be better represented as "compositing" rather than "associative".

Figure G

Generalization (generalization)

Generalization (Figure h) represents the relationship between a more generalized element and a more specific element. Generalization is a UML element that is used to model inheritance. In Java, this relationship is represented directly by the extends keyword.

Figure h

Implementation (Realization)

Instance (figure i) Relationship UML arrows Specify a contract between two entities. In other words, one entity defines one contract and the other guarantees the performance of the contract. When modeling a Java application, the implementation relationship can be expressed directly with the Implements keyword.

Figure I

Parse the meaning of UML arrows and lines (go)

Related Article

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.