In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail about the relationship between classes in UML. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Overview
In the UML design class, the class relationship is divided into Generalization (generalization), Dependency (dependency relationship), Association (association relationship), Aggregation (aggregation relationship), and Composition (combinatorial relationship)!
2. Generalization (generalization)
Generalization (generalization) is represented as an inheritance or implementation relationship (is a). The concrete form is the inheritance relationship between class and class, the inheritance relationship between interface and interface, and the implementation relationship between class and interface.
3. Dependency (dependency)
It is represented as a parameter in the function (use a). Is a connection between classes, indicating that one class depends on the definition of another, and a change in one class affects the other. For example, if A depends on B, B is represented as a local variable, a parameter to a method, or a call to a static method.
4. Association (Associated)
Expressed as a variable (has a). A join between a class that makes one class know the properties and methods of another class. For example, if A depends on B, B is represented as a global variable of A. The association relationship has two-way association and one-way association. Two-way association: both classes know the public properties and operations of the other class. One-way association: only one class knows the public properties and operations of the other class. Most associations should be one-way, and one-way relationships are easier to establish and maintain, helping to find classes to take.
5. Aggregation (aggregation)
A kind of association relationship is a strong relationship. The aggregate relationship is the relationship between the whole and the individual. The two classes of the general association relationship are at the same level, while the two classes of the aggregation relationship are at different levels, one is the whole, the other is the part. At the same time, it is a weak "ownership" relationship. It shows that An object can contain B object, but B object is not part of An object. Specifically, if An is composed of B, it shows that A contains the global object of B, but the B object can not be created at the time when An is created.
6. Composition (combination)
One kind of association relationship is stronger than aggregation relationship. It requires that the object that represents the whole in the ordinary aggregation relationship is responsible for the life cycle of the object that represents the part. Composition (combinatorial relationship) is a strong "ownership" relationship, which embodies the strict relationship between the part and the whole, and the life cycle of the part is consistent with that of the whole. If A consists of B, it shows that A contains the global object of B, and the B object is created at the time An is created.
This is the end of this article on "what are the relationships of classes in UML?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.