Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between dependencies and associations in UML class diagrams

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the difference between dependency relationship and association relationship of UML class diagram. what is introduced in this article is very detailed and has a certain reference value. Interested friends must read it!

1. Dependency (Dependencies)

UML class diagram dependency relation is a kind of usage relationship, and the change of a particular thing may affect the thing that uses it, and vice versa. Used when you want to show one thing using another, a relationship between two elements in which a change in one element (server) will affect the other element (customer) or provide it (customer) with the required information. It is a simple method to form the relationship between different models. Dependencies represent the semantic relationship between two or more model elements. It only connects the model elements themselves and does not need to express its meaning with a set of instances. It represents a situation in which some changes in the provider require or indicate changes in the customer in the dependency.

According to this definition, association and generalization are dependencies, but they have more special semantics, so they have their own names and detailed semantics. We usually use the word dependency to refer to other relationships. Dependencies are represented by a virtual arrow from the customer to the provider, distinguished by a stereotyped keyword, and typically, the UML class diagram dependency is represented by the method of one class using another class as a parameter.

two。 Association relationship (Association)

Association is a structured relationship, which means that one object is related to another. Given two associated classes, the object of one class can be obtained from the object of the other class. Relevance has dualistic and pluralistic relations. Binary relationship refers to an one-to-one relationship, while pluralistic relationship is an one-to-many or many-to-one relationship. It is common to connect the same class or two different classes with solid lines. Use association when you want to represent a structured relationship. If there is a connection between the instances of several class elements, then the semantic relationship between these class elements is association. Associations describe discrete connections between objects or instances in a system.

An association joins a class element that contains two or more ordered tables if replication is allowed. The most common association is the binary correlation between a pair of class elements. One of the instances of the association is the chain. Each chain consists of a set of objects (an ordered list), each of which comes from the corresponding class. The binary chain contains a pair of objects. Associate information with relationships between objects in the system. When the system executes, connections between objects are established and destroyed. Relationships are the "glue" used throughout the system, and without it, there are only isolated classes that don't work together. If the same class appears more than once in an association, a single object can be associated with itself. If the same class occurs twice in the same association, the two instances do not have to be the same object, as is usually the case. A binary association is represented by a connection that connects two classes.

Aggregation represents the relationship between the part and the whole, which is represented by a line segment with an empty diamond at the end, and the empty diamond is connected with the aggregation class. Composition is a stronger form of relevance, and the whole has the unique responsibility of the management part, which is represented by a solid rhomboid attached to the composition end. There is a separate association between each class that represents the part and the class that represents the whole, but for convenience, the wires are combined together, and now the whole set of associations is like a tree.

These are all the contents of the article "what are the differences between dependencies and associations in UML class diagrams? thank you for reading!" Hope to share the content to help you, more related 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report