参与方角色和限界上下文
我正在尝试使用 派对场所 和 Role 来自 Java Color 建模的原型。
此外,我还尝试结合 DDD 最佳实践,现在假设我们有 1 个人扮演 2 个角色 在我的应用程序中说“客户”和“患者”。
客户角色用于 CRM 边界上下文,患者角色用于医院管理边界上下文。
我的角色类可以使用弱 id 访问人员详细信息,弱 id 是一个可以唯一表示人员的值对象,可以找到此方法的详细信息 此处 。
现在,在聚会场所事物原型中,指定的职责之一是列出聚会所扮演的角色的能力。
鉴于角色存在于不同的限界上下文中,如何实现这一目标?
因此,理想情况下,客户和患者不应与人员存在于同一限界上下文中
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自从我提出问题以来,我所了解到的是,一个人(一方)需要了解它所扮演的所有角色的情况很少见。
一个人需要什么样的不变量来保持其所扮演的所有角色?
所以基本上 DDD 会说 Person 不需要知道它在各个 BC 中扮演的所有角色。
在上面的示例中,CRM BC 中的 Customer 类将了解它所扮演的角色的人员(一方)。
并且医院管理 (HM) 有界上下文中的 Patient 类也会知道它所扮演的角色的 Person (Party)。
然而,Person 类不知道 Customer 类或 Patient 类。
事实上,基于 UL(通用语言),CRM BC 中的 Person 类可能看起来与 HM BC 中的 Person 类非常不同。
来自不同上下文的 Person 类之间的相互关联方式是使用软标识符。
请参阅此处了解更多详细信息。
谢谢
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