Model Mitosis by Julien Topçu & Josian Chevalier

Discover how to tame complexity in your models by refactoring with a shared kernel, anti-corruption layer, and microservices architecture, illustrated with a real-world example of booking and search domains.

Key takeaways
  • Model tension is a source of complexity and coupling between domains.
  • A shared kernel helps to reduce model tension by sharing common concepts and behavior between domains.
  • A transitional shared kernel can be used to refactor code and reduce coupling between domains.
  • Code duplication is not always a bad thing if it helps to decouple domains and reduce complexity.
  • The anti-corruption layer is used to protect the bounded context of the booking domain from changes in the search domain.
  • The booking and search domains have different business logic and invariants, and need to be separated to avoid complexity and coupling.
  • A microservices architecture can be used to further decouple the domains and improve scalability and maintainability.
  • The shared kernel can be used to implement common interfaces and behavior between domains.
  • The fare belongs to the shared kernel.
  • The tax rate comes from the booking domain.
  • The schedule is used to compute the duration and arrival time of the space train.
  • The search and booking domains have different views of the space train, and the shared kernel is used to reconcile these differences.