Hi,
I am confused about relation between subdomains and bounded context.
I know that Bounded Context is the solution space and subdomain is the problem space, which is part of the whole domain as a whole.
In Bounded Context we have our own UL. Words that have double meaning, should be place in different bounded contexts.
Inside our Bounded Context we have a model, which tries to solve our problem.
In perfect world Bounded Context would map 1:1 with subdomain. But mostly in legacy we overlap few ones in one bounded context.
According to red book modules structure would look like that:
com.{company_name}.{bounded_context}.{domain}.{model}
And it perfectly fit to what Eric Evans wrote, that Bounded Context holds a model, which solves the problem.
Here's the first question, where information about our subdomain disappeared? I know I can write Context Map to see that model from this bounded context overlie some subdomains, but I would like to see, that information in code.
1. Is there any possibility to reveal, that information in code? For example, naming modules as my subdomain names. Where subdomain_a can reference aggregates from subdomain_b directly.
com.{company_name}.{bounded_context}.{domain}.{model}
.{subdomain_a}
.{subdomain_b}
2. Next thing that may happen. One of the subdomains may be a core domain and I would like use DDD approach there and only there. Above modules won't work like that, because I am doomed to one architecture.
So for example:
subdomain_a - Core domain, 4 layers architecture, Domain Model
subdomain_b - Subdomain, 2 layers architecture, Anemic Domain Model + Services (CRUD)
subdomain_c - Generic Subdomain, 1 layer, few services (some additional things, not necessary needed in core domain)
subdomain_d - Generic Subdomain, 1 layer, few services (security)
Now should I model it like that?
com.{company_name}.{bounded_context}
.{subdomain_a}.domain.model
.{subdomain_b}.model
.{subdomain_b}.model
If I would model it like, wouldn't be that a 4 Bounded Context for real? Because I have 4 models solving different problems (Then I need to go for bounded context integration patterns)?
If so, how to model it then? I can't have it in single model, because I want to reveal my highlighted core and focus on important things there.
3. Supposing, that my proposal from second question is correct. How can I communicate between those subdomains?
Communication over HTTP, message bus/broker would be overwhelming.
Can I depend on abstraction and inject adapters?
Can I go inside other model and call services directly? (If I would implement it as one model I would be able do it, why shouldn't I be able then, if I just splitted model for transparency).
4. Eric Evans in chapter 15 talk about cohesive mechanisms. I couldn't find any code, diagrams of this neither in blue book, red book or internet.
The example shown in book is about organisation structure and building it over graph model.
How cohesive mechanism should be implemented? As far as I understand I should create one model and extend it in another one. Correct me, if I am wrong.
Sorry, for amount of text, hope it isn't to much.
I just feel, if I won't understand it I will not move any forward.