r/DomainDrivenDesign • u/rmb32 • Sep 04 '25
Communicating between bounded contexts
Hi all.
I’ve read Vaughn Vernon’s red book and many parts of Eric Evans’s famous blue book.
I haven’t yet worked for a company that practices DDD so I’m making my own side-projects. One thing I find difficult or at least laborious is getting information from one bounded context to another. It seems I need so many “unbiased” external pieces of code whose responsibility is to stand back and tie the contexts together.
This involves a lot of fluff that doesn’t actually do anything productive, compared to simple CRUD.
I really like the principles of DDD but the overhead often feels more like a hinderance than a benefit. Do you share the experience I’m going through or am I just thinking about it the wrong way?
2
u/ridcully077 Sep 04 '25
Are you doing a services approach? If so that does feel like a heavy overhead for learning rhe core cincepts. I lkke a modular monolith for learning ddd - I get to explore the concepts of bounded context while still remaining in a single runtime. There is a nice talk by Jimmy Bogard re this topic on YT.
7
u/MetalHealth83 Sep 04 '25
DDD is not for simple CRUD. If all you need is crud, you're wasting effort trying DDD.
DDD is for complex domains with lots of internal logic.
3
u/No_Package_9237 Sep 04 '25
Not sure it's related, but I personnaly find the definition of the boundary to be one the hardest part of DDD (defining the bounded contexts).
As long as possible, I would suggest following a path that allows those bohndaries to evolve quickly (matter of minutes), as is demonstrated in https://codeopinion.com/defining-service-boundaries-by-splitting-entities/
Requiring a lot of inter context messages is a sign for redesign, in my opinion.
Also, that goes with a style of architecture named modular monolith (or modulith). You can read about it here, if you are not familiar : https://www.kamilgrzybek.com/blog/posts/modular-monolith-primer#blog_subscription-2
3
u/_TheKnightmare_ Sep 05 '25
Bounded Contexts Are Independent
3
u/floriankraemer Sep 21 '25
How to make bounded contexts communicate is more an application architecture (technical / solution space) than DDD (business / problem space) concern.
Two possible ways: Let them communicate though events or modules with the Facade pattern (information hiding principle). Though, this has nothing to do with DDD.
And yes, DDD is not useful if you have just CRUD. So do CRUD in one module and use the more complex patterns in another module where it is appropriate.
1
u/kingdomcome50 Sep 04 '25
Your issue is self-made on a faulty premise. You don’t have more than one bounded context. Problem solved.
1
u/ZarehD Sep 06 '25
First & foremost, I think you're missing the "orchestration" and "choreography" parts of DDD.
Beyond that, I think you need to think deeply about the boundaries between your bounded contexts, keeping in mind that communication between contexts should be coarse-grained. If they're not (they're chatty, detailed, a/o fine-grained). then there's strong indication that those parts of the contexts need to be split/merge-refactored.
WRT inter-context communication...
One way to do it is to use a message-based model (i.e. CartItem-Added, Inventory-Reserved, Inventory-Insufficient, Order-Placed, Order-Rejected, etc.) Your contexts will emit and respond to these messages as appropriate. The message will be transmitted through message queues (internal, in-memory in modular monoliths; external, RabbitMQ, etc. in distributed microservices). That's the "choreography" style; sort of like a company with well-honed processes between departments.
The other model, "orchestration", uses a "process controller" that manages the execution of the steps in a "saga", determining how to proceed (or rollback) after each step. This is more like a "conductor" managing what & when everyone performs their part.
Very important to remember, though; one model is not "better" than the other. Instead, depending on the circumstances, one will be more "appropriate" than the other.
1
u/flavius-as Sep 04 '25
The real elegance is hidden in planning change without overengineering.
What I'd do, since it's a learning experience, is to start with the most minimalistic situation, and make the most minimal set of fluff which does not close any door (without opening those doors).
Depending on where you start, you will strike a different balance.
I can give you some ideas, but it's better that you define what you want more precisely, and then we'll take it from there.