Re: DRY and cross domain logic
"Jose Fernandez [email protected] [domaindrivendesign]" <[email protected]> Fri, 22 May 2015 11:20:32 -0400
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
The other thing is to make Birthdate a Value Object that you can share among BCs and have all the logic for Age calculation there. That's what I would do. Sent from my iPhone > On May 22, 2015, at 9:59 AM, Tom Eugelink [email protected] [domaindrivendesign] <[email protected]> wrote: > > That is a very abstract and difficult to understand description, from what I gather from it, I would think it means something like a library? > > So maybe an AgeablePerson class, which holds the logic and gets the age as a parameter somehow > > Or an interface + a library class? Something like: > - AgableParty > - AgeCalculator.calculate(AgableParty ap) > > >> On 22-5-2015 15:05, Remy Fannader [email protected] [domaindrivendesign] wrote: >> >> You should introduce parties, with reference to persons (roles as customer or patient) and organization (roles as customer only). >> https://caminao.wordpress.com/how-to-implement-symbolic-representations/patterns/business-patterns-2/parties/ >> Rémy >> >>> On 22 May 2015 at 14:31, Tom Eugelink [email protected] [domaindrivendesign] <[email protected]> wrote: >>> >>> We have a discussion in my current project group about the following: >>> - There are two bounded context. >>> - In each bounded context there is an person-alike entity, in one BC it is Client in the other it is Patient, mostly with their own business logic and methods specific to their roles. >>> - However, at some point Patient requires some determining logic that is implemented in Client. For simplicity let's assume both have a date-of-birth and the to-be-called logic is calculateAge(). >>> >>> This is not something that can be done with events, and because of DRY you do not want to implement calculateAge() twice. What is the best option to calculate the age of a patient? Client and Patient share a unique id, so Patient knows which Client to get. (N.B. I seek a conceptual solution, not one specific to the calculate age problem.) >>> >>> Tom >>> >> > >