Party Role and Bounded Context

713 Views Asked by At

I am trying to use the Party Place Thing and Role archetypes from Java Modelling in Color.

Further i am also try incorporate DDD best practices, Now assume that we have 1 Person who plays 2 roles say Customer and Patient in my application.

The Customer role is used in the CRM Bounded Context and the Patient role is used in the Hospital Management Bounded Context.

My role classes can access the Person details using a weak id, a value object which can represent the Person uniquely, details of this approach can be found here .

Now in the Party Place Thing archetype one of the responsibilities specified is the ability to list down the roles being played by the party.

How does one achieve this given that the Roles exist in different Bounded Contexts ?

So ideally Customer and Patient, should not exist in the same Bounded Context as Person

1

There are 1 best solutions below

0
On

From what i have understood since i asked the question is that, The cases where a Person (Party) needs to know about all the Roles that it plays is rare.

What kind of invariant would a person need to keep over all the roles that it plays ?

So basically DDD would say that Person need not know about all the Roles it plays in various BC's.

In my above example the Customer class in the CRM BC would know about the Person (Party) for which it is playing a role.

and also the Patient class in the Hospital Management (HM)Bounded Context would know about the Person (Party )for which it is playing a role.

However the Person class would not know about either the Customer class or the Patient class.

In fact the Person class in the CRM BC could look very different from the Person class in the HM BC, based on the UL (Ubiquitous Language).

And the way these to Person classes from different contexts would relate to each other is using a soft identifier.

Refer to this book here for further details.

Thanks