admin管理员组文章数量:1122846
the difference between these is that: the first image, the simple many-to-many association indicates that there can only be one association between an instance of user and product. The second instead indicates that there can be multiple associations between the same user and product. That is, if we have user1 and product1 they can also create two associations. The third instead I can't explain its usefulness, can you tell me?
the difference between these is that: the first image, the simple many-to-many association indicates that there can only be one association between an instance of user and product. The second instead indicates that there can be multiple associations between the same user and product. That is, if we have user1 and product1 they can also create two associations. The third instead I can't explain its usefulness, can you tell me?
Share Improve this question asked Nov 21, 2024 at 16:34 dokdok 3917 bronze badges 02 Answers
Reset to default 1You are right. There is no meaningful difference between 2 and 3.
There used to be, but it was thrown out by the UML taskforce in issue UML22-21, albeit for very good reasons. Since this effectivly makes association classes obsolete, issue UMLR-443 tried to get it back in, but this is still open. So, it is really up to your preferences.
Please note, that in the first case, the associations ends could be {non unique}
(default is {unique}
). Then there could be many links between any pair of instances. And then all three diagrams mean the same.
PS: You write "there can only be one association between an instance of user and product". "association" should be replaced with "link". Remember that links are instances of associations.
A class diagram can serve several purposes:
- In a domain model: to model the real world;
- In a conceptual model: to model the objects in an application, from a user's perspective;
- In a physical data model: to model the tables and their relationships in a relational database;
- In a physical class model: to model the classes present in the source code;
- etc.
The association class is mostly used in domain models and conceptual models. It shows that, in this case, User and Product are related and that Purchase provides more details about this relationship.
The third option also appears in such models, if the modeler views the User-Purchase relationship as a different relationship than the Purchase-Product relationship.
In other words, your choice depends on how you perceive the relationship(s) and what you want to convey to the reader.
In physical models, the third option is usually preferred over the second option, because the database or programming language doesn't have the concept of an association class and the model must visualize the implementation.
本文标签:
版权声明:本文标题:uml - class diagram difference between association , association class , intermediate class - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308856a1933810.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论