How to design domain model, if I have an attribute that is related to two entites?

1
I have an entity "machine" and an entity "tool". A machine can have multiple tools and a tool is associated to multiple machines. A tool has an attribute stroke_rate that is not only associated to the tool. That is why i can't put the attribute to the tool entity. If the tool is associated to multiple machines, the attribute stroke_rate is different to each machine.  How can i design this? Normaly i want to add the attribute to the association "Maschine_Tool", but i can't add attributes to a association.  
asked
2 answers
2

Hi Johannes,

 

It seems like you want to store additional information about the association between Maschine and Tool. A design called Information Entites can help you with that .

 

 

Example from the Become a Rapid Developer Path, module 5.3. The information on purple would be your stroke_rate:

image.png

 

 

 

For a quick summary, this kind of design is used to store information about specific associations.

 

I hope that solves your question, if it does please mark it as solved. Best regards,

Oswaldo 

answered
0

Hi Oswaldo, yes thank you. You're right. But this faces another issue, or limited me in my views. 

The usecase is a bit more than these two entites. 

It's actually looks like this. A machine can have multiple Tools, Tools are associated to multiple Machines. A Tool have multiple articles. An article is build from multiple Tools. 

It looks like this:

image.png

So at the moment i can build a listview which lists all machines. If i choose a machine in the list view. I visualize  every tool which is associated to the selected machine. (Listview Tools listen to the widget listview Machines). My third listview shows all articles depending on the tools listview. 

image.png

 

If i choose your solution. It limits me to vizualize these relationships.

Your solution: 

image.png

 

Here I'm not able to vizualize the relationship.

image.png

The first column displays all machines. After the selection of a machine i listen to the listview widget and display all machine_tool_combinations that are associated to the machine. I'm able to display the stroke rate and the name of the tool. But if choose the combination i can't display the articles in the next view. Cause I don't select a tool entity. Only the machine_tool_combination. 

answered
0

Hi Oswaldo, yes thank you. You're right. But this faces another issue, or limited me in my views. 

The usecase is a bit more than these two entites. 

It's actually looks like this. A machine can have multiple Tools, Tools are associated to multiple Machines. A Tool have multiple articles. An article is build from multiple Tools. 

It looks like this:

image.png

So at the moment i can build a listview which lists all machines. If i choose a machine in the list view. I visualize  every tool which is associated to the selected machine. (Listview Tools listen to the widget listview Machines). My third listview shows all articles depending on the tools listview. 

image.png

 

If i choose your solution. It limits me to vizualize these relationships.

Your solution: 

image.png

 

Here I'm not able to vizualize the relationship.

image.png

The first column displays all machines. After the selection of a machine i listen to the listview widget and display all machine_tool_combinations that are associated to the machine. I'm able to display the stroke rate and the name of the tool. But if choose the combination i can't display the articles in the next view. Cause I don't select a tool entity. Only the machine_tool_combination. 

answered