UML series (ii) Four Relationships

Source: Internet
Author: User

We have already learned the Unified Modeling Language (UML). The core of UML is nine types of graphs. The core of these nine types of graphs is four types of relationships, and association) dependency, generalization, and realization are the following relations:

1. Association: an association is a structured relationship. An object is associated with another object. Given the two associated classes, you can access the related objects of another class from the objects of one class.

Dependencies are extensive and extensive. Generally, there are associations between two objects. The description of the relationship between objects is not specific. In engineering drawing, generally, preparation is required to indicate the relationship between two objects, but cannot be expressed by associations. For example, Apple and apple are a pair of correlated objects, but they also have implementation relationships, which requires us to specify the relationships between objects, which is very important for project structure design.

If you think there is a link between the two business concepts, but you are not sure about the relationship, draw a link first to indicate the association. As you deepen and embody your business, then improve and modify the association.

2. Dependency (dependency): For two objects x/y, if the object x changes, it may cause changes to the other object Y. In this case, y depends on X.

For example, if a smoke bot is not able to survive, it can be said that it is dependent on smoke. The statement is as follows:

For the so-called dependency relationship, the degree of dependency is quite short. Not necessarily, a cannot survive without B. In the specific business logic, a needs B to help with a specific task, this is also a dependency.

3. generalization (generalization): The Generalization relationship in UML defines the classification relationship between general elements and special elements, which is similar to the inheritance relationship in C ++ and Java.

For example, student, teacher, and employee are three types. We can know that students and teachers are actually employees. They both inherit the characteristics of employee and have their own attributes, which can be expressed:

As shown in the preceding figure, student and teacher inherit the attributes of the employee. Arrows refer to the inherited classes.

4. realization (Implementation): The Implementation relationship connects a model element (such as a class) with another model element (such as an interface), where an interface is only a description of behavior rather than a structure or implementation. The real implementation is completed by the previous model element. Keyboard class implementation, typewriter interface function.

The most basic of UML is the four relationships. Some relationships can be further refined. First, nine types of diagrams in UML can be drawn only by clarifying these relationships, because they are composed of dependencies and these four relationships.


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.