What is the importance of multiplicity of associations in class diagrams?

What is the importance of multiplicity of associations in class diagrams? Why and when should we indicate them? Thanks.

+4
source share
3 answers

They allow the designer a quick visual way of communication, which will be difficult without multiplicity. You will need to use notes or other annotations to use the space in the diagram.

In a UML diagram, I want to have a multiplicity for all other associations than one-on-one.

Why?

  • One on one - this is a visual signal that you get from a simple association. This is the default.
  • Many contain domain knowledge (car-> wheel usually represents a 1 β†’ 4 association. An association without plurality looks like a car with one wheel.
  • The designer can β€œdeserialize” what he thinks is provided, because everyone in the domain probably knows them, but the developer probably does n't !
+3
source

They convey business rules more directly. For example, a house contains one or more rooms.

+1
source

UML is used in many ways. There are so many things a class diagram can show. If you are trying to fully document the system design, you may need to show everything. If you are trying to explain a more specific aspect of a design, show it only if it matters (i.e., It relates to how this aspect will be developed / implemented).

+1
source

Source: https://habr.com/ru/post/1310197/


All Articles