DDD: restricted contexts - domain objects that refer to problems in another restricted context

I got confused about how to define restricted contexts, where there are common problems between them, and how to represent this using domain objects.

For example: The client has many products in the context of the client. The company has a list of products in the context of the company.

Thus, the client is managed through the context of the client, and the company through the context of the company

Given that contexts are in different modules.

If I want to provide company address information for a product, how should this be handled?

Am I referring to a module containing the Company context in the module containing the client, or am I creating a company object in the client context specifically designed for use in interacting with customers?

thanks

+4
source share
2 answers

You may have different representations of the same object in different limited contexts. Company in Company BC can be very different from the company in User BC. All they have is some correlation identification.

+5
source

So we approached him in our project.

For one limited context, we used the contract as the Aggregate Root, and in another limited context, we used the contract as an object / value object

In the first / BC module, we had a large contract class with great behavior in it, and in the second / BC module, we had another contract class that contained only a few properties with private setters.

Thus, it would be possible to split 2 BC into separate service assemblies in the SOA design.

+1
source

All Articles