In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the six relationships between UML object diagram and class diagram". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the six relationships between UML object diagrams and class diagrams?"
This paper focuses on the relationship between UML object diagram and class diagram, including dependency, generalization, association, aggregation, composition and implementation. I hope you have a clear understanding of the relationship between UML object diagram and class diagram through the introduction of this article.
The relationship between UML object Diagram and Class Diagram
Class diagram and UML object diagram (an object is an instance of a class, so an object diagram is an instance of a class diagram, and there is no underscore under the class name of the class diagram, but there is an object diagram):
1. Dependency (Dependence):
Assuming that the change of class A causes the change of class B, it is said that the name class B depends on class A.
There are three cases of dependencies:
1. Class An is a member variable of Class B.
2. Class An is a parameter of class B methods.
3. Class A sends messages to class B, which affects the change of class B.
Represented by dashed lines with arrows
2. Generalization relation (Generalization):
An is the parent class of B and C, and BMagol C has a common class (parent class) A, which indicates that An is the generalization of BMague C.
In UML object diagrams and class diagrams, there are three requirements for generalization relationships:
1. The subclass and the parent class should be exactly the same, and the parent class should have all the attributes, operations and subclasses.
2. In addition to the information consistent with the parent class, the subclass also includes additional information
3. Where you can use an instance of a parent class, you can also use an instance of a subclass
Represented by solid lines with hollow triangles
3. Relationship (Association):
The connection between classes, such as the association between a basketball player and a team (shown in the following figure). Among them, the "employee" and "employer" on both sides of the association indicate the relationship between them, while the number indicates the limitation of the relationship between the two, which is the multiplicity of the relationship between the two. There are usually "*" (for all, unlimited), "1" (for there is and only one), "0." (for 0 or more), "0 # 1" (for 0 or one), "n.m" (for n to m), "m. *" (for at least m).
In association, there is a kind of "limited relevance", and there is also a kind of self-relevance. In addition, the association between objects is not so complex, just instantiating the association of the class.
Use solid lines with numbers to represent
4. Aggregation relationship (Aggregation):
The concrete relationship between UML object diagram and class diagram represents the relationship between the whole and the part, which can be separated from the whole.
The telephone includes a microphone
Computers include keyboards and monitors. A computer can be matched with multiple keyboards and monitors to make sure that keyboards and monitors can be separated from the mainframe, and the mainframe can choose other keyboards and monitors to form the computer.
Represented by a solid line with a hollow diamond
5. Combinatorial relationship (Composition):
It is also the relationship between the whole and the part, but the whole and the part cannot be separated.
For example: the company and the department, the department is the part, the company is the whole, the finance department of company A cannot exchange with the finance department of company B, that is to say, company A cannot open with its own finance part; the heart of people
Represented by a solid line with a solid diamond
6. implementation relationship (Implementation):
The implementation relationship between UML object diagram and class diagram is used to define the relationship between classes or construction structures of interfaces and solid-line interfaces. Interfaces are a collection of operations, which are used to specify classes or build a service.
Represented by dashed lines with hollow triangles
At this point, I believe you have a deeper understanding of "what is the six relationships between UML object diagram and class diagram". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.