Interaction Between Contexts

Shared Kernel

  • A common codebase which is used on multiple bounded contexts

  • The goal is to reduce code duplication and increase consitency

  • E.g. some utility classes, database schema, or other common code parts

Customer-Supplier

  • A relation when one context or subsystem acts as a customer and the other acts as a supplier

  • The interface can be in a form of API or message queue

  • E.g. a shopping ecommerce subsystem and the reporting subsystem, where the reporting subsystem depends on the shopping subsystem. The two might use different technology to achieve different goals, we might need some sort of interface (in this case, some sort of data pipeline might be a good fit here). This way, both can have different database schema that perfectly fit their own use case.

Conformist

  • More or less like shared kernel, but if shared kernel can be modified by the teams that are using it, conformist is more of using it as is, the consumer teams have no power to modify the code.

Open Host Service

  • Allows the domain model to be accessible by external systems or services through well defined API

  • E.g. a payment gateway service which might be used by multiple other systems or services

Anticorruption Layer

  • ACL acts as a mediator between the two systems and translates the messages or data exchanged between them so that each system can understand and use it.

  • The ACL is responsible for maintaining the integrity of the domain model of each system and preventing any corruption of the domain model by the other system.

Last updated