In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what is the difference between several UML relationships, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The difference of several kinds of UML Association Relations
Association is a kind of static structural relationship, in other words, it is biased towards data relationship. So, placing associative relationships between the two categories also means that the relationship must be saved, which is why associative relationships are most common in UML class diagrams. For example, the relationship between a customer and an order will use a combination relationship because we want the system to preserve the relationship between the two.
The two ends of the binding relationship are usually equal. If you want to express the meaning of the whole-part (whole-part), you can use the aggregate relation (aggregate, hollow diamond) or the combinatorial relationship (composite, solid diamond).
Special attention is paid to:
1. Aggregation and combination are a kind of combinative relationship, but they have the meaning of whole-part.
two。 In an aggregation relationship, the wholeobject does not have the life cycle of the partobject, so when the whole piece is deleted, the part will not be deleted. In addition, multiple pieces can share the same part.
3. In a combinatorial relationship, the whole piece has the life cycle of the part, so when the whole piece is deleted, the part must be deleted. Moreover, multiple pieces cannot share the same part at the same time.
As for, in practice, whether to adopt the aggregation relationship or the combination relationship is not determined by the truth, but by the enterprise rules. For example, the relationship between orders and details is usually combined, and once the order is deleted, the details below will be deleted at the same time. However, this is a more common enterprise rule, just imagine, perhaps some areas of transactions can be opened, when the order is cancelled, the original details can be incorporated into other orders, if so, it is appropriate to use aggregation relationship.
Generalization is the relationship between two categories, which is different from the combination, aggregation or combination relationship mentioned above, it is a classification relationship. In other words, when the individual of a concept or thing can be divided into a general category (parent category) and a special class (subcategory), a general relationship can be placed between the two. For example, we would say that wireless mouse and wired mouse (they are both special categories / subcategories) are both a kind of mouse (general category / parent category).
Dependency relationship is different from the above several relationships, first explain why many UML books will say that it is a short-term relationship, in fact, this is relative to the combination (aggregation, combination) relationship, as we mentioned earlier, the combination relationship is a static structural relationship that needs to be preserved. By contrast, dependencies do not need to be stored, so they are said to be short-lived.
The most common dependency relationship (dependency) is a usage relationship. For example, there is a customer category that calculates the annual transaction total. In this operation, it must be connected to a group of transaction objects of the current year, and the call transaction object obtains the transaction amount to accumulate in order to calculate the annual transaction total. In this case, there is a temporary dependence between the customer category and the transaction category.
Again, the use of combinations, aggregations, combinations, generalizations or dependencies is not about real phenomena, but about business rules, or what kind of design the designer wants to express. So there is no fixed answer to the relationship between the two categories, it depends on the design.
These are all the contents of this article entitled "what are the differences between several UML relationships?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.