Decoupled bounded contexts
In the previous section, we learned that the ports and adapters should encapsulate the whole application, not each bounded context separately. How do we keep the bounded contexts separate from each other, then?
In a simple case, we might have bounded contexts that don’t communicate with each other. They provide completely separate paths through the code. In this case, we could build dedicated input and output ports for each bounded context like in Figure 13.3.
Figure 13.3 – If bounded contexts (dashed lines) don’t need to talk to each other, each can implement its own input ports and call its own output ports
This example shows a Hexagonal Architecture with two bounded contexts. A web adapter is driving the application and a database adapter is driven by the application. These adapters are representative of any other input and output adapters – not every application is a web application with a database...