DEV Community

Simon Brown
Simon Brown

Posted on

Modelling multiple relationships

The topic of how to model multiple relationships between the same two elements has come up a number of times this week, so here's a quick tip.

To explain the situation, imagine you have an online book store that has customers. Those customers can do a number of things; make purchases, make pre-orders, browse, search, view their previous orders, and so on. To describe this with a diagram, many people would simply draw two boxes, and have one arrow per major use case/feature/story/etc. That would look something like this.

Multiple relationships

While correct and accurate, this approach tends to clutter the diagram, and each time you add a new major feature, you need to add another arrow.

A better way to think about this is that there's a single relationship between the customer and the online book store. Perhaps the customer "uses" the online book store or, to be more descriptive, perhaps the customer "browses and makes purchases using" the online book store.

A single relationship

If you do want to show each of the major use cases/features/stories/etc and how they work at runtime, you can do that with a unique dynamic diagram for each of those use cases/features/stories. With this approach, essentially what you have is a single relationship in the static model, with each dynamic diagram showing an instance of that relationship.

I hope that helps!

Top comments (0)