Re: Sharing Aggregate Roots between Bounded Contexts

"udidahan7" <[email protected]>
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <[email protected]>
The reason you're having issues with separation of responsibility and coupling is the assumption that a given BC needs to do everything with a user. Instead, consider a composite UI where there can be multiple BCs interacting with the user simultaneously.

In short, the points/payments BC would always be there - knowing how many points a user has as well as what the required number of points someone has to have in order to access a given "area".

Cheers,

Udi


--- In [email protected], "wonderfulworldofpingpong" <varghese.pallathu@...> wrote:
>
> Paul, thanks for clarifying on the aggregates.
> 
> Here is an example I'm talking about. You are going to a County fair. You can pay cash and get points. With those points you can visit the game area, food stalls, buy products etc... For example, you buy 100 points for $100. You take the points to the game area and play poker. Then you go to the food area and have some food. 
> 
> Every time you visit a section in the County fair, the staff will ask you how many points you have. Getting to the DDD, we can consider the game area as one BC, food management as one BC and products selling area as one BC. The visitor is the same. All the BCs are concerned about only one thing, that is how many points the visitor has. They are not concerned about his name, address or how much money he has. As long as he has points, he can visit that section. So, an entity called 'visitor' is the same for all the BCs. The Repository to read the points from the datastore is also the same. In this case, do you prefer to put that visitor in a shared kernel? Probably not, the same visitor will be concern for the security BC which needs his name, address and phone etc...
> 
> Hope that explains a scenario of the topic we are talking about.
> 
> --- In [email protected], Paul Rayner <paul@> wrote:
> >
> > On Sun, May 26, 2013 at 5:29 PM, wonderfulworldofpingpong <
> > varghese.pallathu@> wrote:
> > 
> > > **
> > >
> > >
> > > Thanks Paul.
> > >
> > > So, even though it causes code duplication but it is required that two BCs
> > > need to have it's own aggregates else it needs to be in a shared kernel. Am
> > > I right?
> > >
> > Right. Bounded contexts have different models. There is nothing to share,
> > concept-wise. Start with the model. I get the sense you are thinking
> > implementation-only.
> > 
> > And avoid shared kernels, if you can.
> > 
> > >
> > > Is it okay to share the implementation of a repository?
> > >
> > Generally, no. Why would you want to do this, since it would couple two
> > bounded contexts tightly together? I would need to see an example.
>




------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.