Meanings of UML diagram symbols

Source: Internet
Author: User
Class)

Class (FigureIs an object blueprint, which contains three components. The first is the class name defined in Java. The second is attributes ). The third is the method provided by this class.

You can append a visibility modifier before attributes and operations. The plus sign (+) indicates public visibility. Minus (-) indicates private visibility. # Indicates protected visibility. Omitting these modifiers indicates visibility at the package level. If an attribute or operation has an underscore, it indicates that it is static. In the operation, you can also list the parameters it accepts and the return type, as shown in the "Java" area of.

Figure

 

 

 

Package)

Package (figureB) Is a combination mechanism for conventional purposes. A package in UML corresponds directly to a package in Java. In Java, A package may contain other packages, classes, or both. During modeling, you usually have a logical package, which is mainly used to organize your model. You will also have a physical package, which is directly converted into a Java package in the system. The name of each package uniquely identifies the package.

Figure B


Interface)

Interface (Figure CIs a collection of operations, which specifies the services provided by a class. It directly corresponds to an interface type in Java. The interface can be represented by the icon in Figure C or a standard class attached to <interface>. Generally, you can know the relationship with other classes based on the interface in the class diagram.

Figure C

Link

The following examples show various relationships for a specific purpose. Although the syntax is correct, these examples can be further refined to include more semantics within their effective scope.

Dependency)

An "use" Relationship between entities implies that after a specification of an object changes, other instances dependent on it may be affected (Figure D). More specifically, it can be converted to any type of reference to a class or object not in the instance scope. This includes a local variable that references an object obtained through method call (as shown in the following example ), or reference a static method of a class (there is no instance of that class at the same time ). You can also use "dependency" to indicate the relationship between packages. Because the package contains classes, you can express the relationship between packages and packages based on the relationships between classes in those packages.

Figure D


Association)

A structured relationship between objects indicates that objects are connected to each other. The arrow is optional and is used to specify the navigation capability. Without arrows, it implies a two-way navigation capability. In Java (Figure E) To an instance scope variable, as shown in the code in the "Java" Area in Figure E. You can append other modifiers to an association. The multiplicity modifier implies the relationship between instances. In the Demo code, the employee can have 0 or more timecard objects. However, each timecard only belongs to a single employee.

Figure E

Aggregation)

Aggregate (Figure FIs a form of association, representing the overall/local relationship between two classes. Aggregation implies that the whole is at a level higher than the local level, while association implies that two classes are at the same level in concept. Aggregation is also converted to an instance scope variable in Java.

The difference between Association and aggregation is purely conceptual and strictly reflected in semantics. Aggregation also implies that there is no loop in the instance diagram. In other words, it can only be a unidirectional link.

Figure F

Composition)

Synthesize (Figure G) Is a special form of aggregation, suggesting that "local" is responsible for the lifetime of the "whole. Synthesis is not shared. Therefore, although local data may not be destroyed as a whole, it is either responsible for local survival or destruction. It cannot be shared with other entities. However, ownership can be transferred to another object as a whole, and the latter will assume the responsibility for survival.

The relationship between employee and timecard may be more suitable for "merging", rather than "associating ".

Figure G

Generalization)

Generalization (Figure H) Represents the relationship between a more general element and a more specific element. Generalization is a UML element used to model inheritance. In JavaExtendsKeyword to directly represent this relationship.

Figure H


Implementation)

Instance (Figure I) Link specifies a contract between two entities. In other words, one entity defines a contract, and the other entity guarantees the performance of the contract. When modeling Java applications, the implementation relationship can be directly usedImplementsKeyword.

Figure I

 

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.