Search code examples
umlclass-diagram

UML-model class affectation


enter image description here

I am trying to model with UML this problem I have, that is a specific exchanger structure.

I have the central class, Matrix, that has several circuits flowing through it, class Circuit. This matrix is a stack of passages (class Passage), in which circulates one or more circuits. One circuit can also flow several passages.

Let's say passages objects are named "A", "B" and "C", matrix can look like : ABCCABA...

I would use a reference, like an array of pointers

How do I model that stacking pattern in UML?

Then, I would like to say that A contains 2 circuits objects "1" and "2", B contains "2" and C contains "3".

Help me finding out how to do these


Solution

  • Your question still is in a form that it allows (too) many answers, but I'll try this way.

    • For each of the steps below involve the appropriate stakeholders to take part in the design.
    • Make up your mind what you actually want to do. What is the purpose of the matrix/stack (your question does not provide background).
      • A good way is to create use cases to describe the goals of your system
    • Provided you know what those system goals are create a domain using a class diagram. The above class diagram looks okay but without context I can't tell if it's right or wrong.
    • Once you got that structural model you can start designing functionality. The best approach is this:
      • Create a collaboration for each of your use cases (also known as use case realizations; they have a realization towards the use case).
      • Inside each collaboration create sequence diagrams and place instances of those classes on it which are supposed to take part in this specific use case
      • Now start thinking how these instances need to communicate to perform the desired task
      • Draw a message to show the communication and create a method in the according class (some tools support this in one step)
      • Review communication and domain model

    Roughly these are the major design steps. As you see I did not provide a specific answer to the problem you probably has in mind. Simply because it's not specific enough.

    Give a person a fish and it will have a meal for a day. Teach it to fish and it has a meal for the rest of its life.