In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you an example of UML object relationship analysis, I hope you will learn something after reading this article, let's discuss it together!
[Association of UML object relationships]
Association relationship is the simplest and most abstract description of the relationship between objects. It only describes that there is a business and conceptual logical relationship between object An and object B, but the two sides of the relationship do not contain the attributes of each other.
[aggregation of UML object relationships]
Aggregation relationship is a special association relationship, which not only has the characteristics of association relationship, but also includes the following rules:
a. There is an inclusive relationship between object An and object B.
b. Between object An and object B, there must be a container on one side and an element on the other. Namely "whole-part" relation
c. The lifecycles of container-side and element-side objects are independent of each other and do not depend on each other, that is to say, a
A kind of "loose" connection. Containers and elements can be created and destroyed independently. The container does not exist and does not affect the existence of the element. The container can still exist if the element does not exist.
d. The container side can have no elements or one or more elements
e. Elements can be included in one container or in multiple containers
f. Adding elements to or removing elements from a container does not affect the container
[combinatorial relationship of UML object relation]
Combinatorial relationship is a special aggregation relationship, which not only has the characteristics of association relationship and aggregation relationship, but also includes the following rules:
a. The lifecycles of container-side and element-side objects are interdependent. That is, the element depends on the container, and once the container does not exist, then the element cannot exist. The container must be created before the element, and the element must be destroyed before the container.
b. Elements can only be "contained" in one container.
[example Analysis of UML object Relations]
a. Example analysis of association relations:
Student-grade
There is a relationship between students and grades. You can't write the attributes of students into the object of grades. By the same token, you can't write the attributes of grades into the objects of students, but there is indeed a business relationship between the two. And it's fixed.
b. Example analysis of aggregation relationships:
Class-Student / car-Accessories
The relationship between class and students, cars and accessories is an aggregate relationship. First of all, a class can contain zero to multiple students, and a car can contain up to zero (before assembly) at most accessories.
Second, students can be created first, then create classes, and then add and remove students to the class. Accessories can be created and stored in a warehouse before being assembled into a car. In the class, before the car object is formed, the relationship between students and accessories
The elephant can already exist (that is, the lifecycle of the container and the element object are independent)
c. Example analysis of combinatorial relations:
Fund account-single transaction
The fund account and a single transaction are a combination relationship. First of all, a single transaction must depend on the fund account, that is, we must first create the "container side" of the fund account, and then we can create the "element side" of the single transaction. Then link the single transaction to the fund account. We cannot execute a single transaction without a pre-existing fund account. We cannot first create a single transaction, then create a fund account, and then link to the transaction.
This is different from the relationship between the above class and students, cars and accessories.
Secondly, a single transaction can only be linked to a specific fund account, that is, the element can only be "contained" in one container.
[thinking about the extension of UML object relation]
In the relationship between object and object, the "dependency" relationship is sometimes mentioned, that is, object A depends on object B to complete an operation, so does this relationship also belong to "association relationship"?
Personally, I don't think this is a kind of "related relationship". Because among the three relationships mentioned above, in addition to being fixed, another important feature of each relationship is that these relationships need to be "persisted and preserved".
The dependency relationship is only the reference (or invocation) relationship between the object and the object, which occurs only during the run time, not in the business, and the conceptual relationship does not need to be saved. So "dependency" does not belong to the object relationship in UML.
After reading this article, I believe you have some understanding of "sample Analysis of UML object Relations". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
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.