SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
DDD Strategic Design
Introduction to Context Maps
Paulo Clavijo - April 2018DDD Guild - GSAD Dell-EMC
Domain-driven design - 10000 foot view
Strategic Design
Ideally, it would be preferable to have a single, unified model. While this is a noble goal, in
reality it typically fragments into multiple models. It is useful to recognize this fact of life and
work with it.
Strategic Design is a set of principles for maintaining model integrity, distillation of the
Domain Model and working with multiple models.
● Context
● Distillation
● Large-Scale Structure
Model Integrity Patterns
Problem Space vs Solution Space
Sales
domain
Booking
domain
Marketing
domain
Problem Space (real world) Solution Space (domain model)
design process
Booking
context
Sales
context
Marketing
context
Dom
Ap ic o
Ser s
AP
/In
ef
In
as
c
e
Dat e
Architecture
do mo s he t ,
al p en po n a d
co sa f e c
Bounded Context
Multiple models are in play on any large project. Yet when code based on distinct models is combined, software becomes
buggy, unreliable, and difficult to understand. Communication among team members becomes confusing. It is often unclear
in what context a model should not be applied.
Therefore: Explicitly define the context within which a model applies. Explicitly set boundaries in terms of team
organization, usage within specific parts of the application, and physical manifestations such as code bases and
database schemas. Keep the model strictly consistent within these bounds, but don’t be distracted or confused by
issues outside.
Domain-Driven Design, Eric Evans
Bounded Context
Bounded Context gives team members a clear and shared understanding of what has to be consistent
and what can develop independently
Bounded Context
Out of context
Out of context
Ubi o s L u g , un e
an l om od
Un e n u d o l
Bounded Context
Large or complex models should be divided into bounded contexts where a model can be explicit by being
understood in a specific context.
customer
message
quote
quote
Sales context
Booking context
Marketing context
notes
customer
address
flight
payment
method
newsletter
customer
loyalty
booking
paid
flight
cancelled
booking
Big Ball of Mud
Bounded Context
There is no direct one to one correlation between
● Domain - Context
● Context - Module
● Context - Micro-service
Bounded Context
Context Map
An individual bounded context leaves some problems in the absence of a global view. The context of other models may still
be vague and in flux.
People on other teams won’t be very aware of the context bounds and will unknowingly make changes that blur the edges
or complicate the interconnections. When connections must be made between different contexts, they tend to bleed into
each other.
Therefore: Identify each model in play on the project and define its bounded context. This includes the implicit
models of non-object-oriented subsystems. Name each bounded context, and make the names part of the
ubiquitous language. Describe the points of contact between the models, outlining explicit translation for any
communication and highlighting any sharing. Map the existing terrain.
Domain-Driven Design, Eric Evans
Context Map
A model is valid in a specific context. Different context might need different version of the model, due to
specific purposes.
Define Bounded Contexts according to the way things are now. This is crucial. To be effective, the
Context Map must reflect the true practice of the teams, not the ideal organization
Types of Bounded Context Relationships
● Shared Kernel
● Customer / Supplier
● Conformist
● Anticorruption Layer
● Separate Ways
● Open Host Service
● Published Language
Shared Kernel
Two teams share a subset of the domain model
including code and maybe the database.
Teams involved must collaborate, any change in
a kernel model must be done only in
consultation with the other team.
Payroll context
employee
Employee Management
context
Em oy o l
Customer / Supplier
A Customer/Supplier or Consumer-Driven
Contract relationship is where the downstream
context defines the contract that they want the
upstream context to provide.
The two domains can still evolve independently,
as long as the upstream context fulfills its
obligations under the contract.
The downstream team, considered as the
customer, sometimes has veto rights.
Team 1
Team 2
Conformist
The downstream team conforms to the model of
the upstream team. There is no translation of
models and not vetoing. If the upstream model
is a mess, it propagates to the downstream
model.
Team 1
Team 2
bar
foo
bar
foo
Anticorruption Layer
A layer that isolates a client's model from
another's system model by translation. Team 1
Team 2
bar
foo
cat
zoo
ACL
Separate Ways
There is no connection between the bounded
contexts of a system. This allows teams to find
their own solutions in their domain.
Team 1 Team 2
pig
zoo
cat
zoo
Open Host Service
Each Bounded Context offers a defined set of
services that expose functionality for other
systems. Any downstream system can then
implement their own integration. This is
especially useful for integration requirements
with many other systems.
Team 1
Team 2
OHS
Published Language
Similar to OHS. However it goes as far as to
model a Domain as a common language
between bounded contexts.
Team 1
Team 2
PL
Language
Context Map - Examples
Context Map - Examples
Communication between Bounded Contexts
● Interfaces beetween modules (monolith)
● RPC with SOAP
● REST
● Using Events
Transfering data between Bounded Contexts
References
● Domain-Driven Design. Eric Evans (2003).
● Domain-Driven Design Distilled. Vaughn Vernon (2016).
● Implementing Domain Driven Design. Vaughn Vernon (2013).
● The Anatomy Of Domain-Driven Design. Scott Millett and Samuel Knight.
● Domain Modeling Made Functional. Scott Wlashchin (2018).

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

DDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by ExampleDDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by Example
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLC
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Software architecture patterns
Software architecture patternsSoftware architecture patterns
Software architecture patterns
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Hexagonal Architecture.pdf
Hexagonal Architecture.pdfHexagonal Architecture.pdf
Hexagonal Architecture.pdf
 
Software Architecture Patterns
Software Architecture PatternsSoftware Architecture Patterns
Software Architecture Patterns
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 

Ähnlich wie DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018

Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile project
Harald Soevik
 

Ähnlich wie DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018 (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
 
Writing good C# code for good cloud applications - Draft Oct 20, 2014
Writing good C# code for good cloud applications - Draft Oct 20, 2014Writing good C# code for good cloud applications - Draft Oct 20, 2014
Writing good C# code for good cloud applications - Draft Oct 20, 2014
 
DESIGN AND DEVELOPMENT OF BUSINESS RULES MANAGEMENT SYSTEM (BRMS) USING ATLAN...
DESIGN AND DEVELOPMENT OF BUSINESS RULES MANAGEMENT SYSTEM (BRMS) USING ATLAN...DESIGN AND DEVELOPMENT OF BUSINESS RULES MANAGEMENT SYSTEM (BRMS) USING ATLAN...
DESIGN AND DEVELOPMENT OF BUSINESS RULES MANAGEMENT SYSTEM (BRMS) USING ATLAN...
 
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
 
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
 
1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf
1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf
1. Why Event-Driven Microservices _ Building Event-Driven Microservices.pdf
 
The Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsThe Big Picture - Integrating Buzzwords
The Big Picture - Integrating Buzzwords
 
DDD In Agile
DDD In Agile   DDD In Agile
DDD In Agile
 
Architecting for Change: An Agile Approach
Architecting for Change: An Agile ApproachArchitecting for Change: An Agile Approach
Architecting for Change: An Agile Approach
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
DDD
DDDDDD
DDD
 
Mca 504 dotnet_unit4
Mca 504 dotnet_unit4Mca 504 dotnet_unit4
Mca 504 dotnet_unit4
 
Ferronato Finnegan One Digibiz Long
Ferronato Finnegan One Digibiz LongFerronato Finnegan One Digibiz Long
Ferronato Finnegan One Digibiz Long
 
Ports adapters architecture (hexagonal architecture)
Ports adapters architecture (hexagonal architecture)Ports adapters architecture (hexagonal architecture)
Ports adapters architecture (hexagonal architecture)
 
Lecture 18 - Model-Driven Service Development
Lecture 18 - Model-Driven Service DevelopmentLecture 18 - Model-Driven Service Development
Lecture 18 - Model-Driven Service Development
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven Design
 
The Perfect Couple
The Perfect CoupleThe Perfect Couple
The Perfect Couple
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile project
 

Mehr von Paulo Clavijo

Mehr von Paulo Clavijo (15)

Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021Consumer-Driven Contract Testing - Workshop - January 2021
Consumer-Driven Contract Testing - Workshop - January 2021
 
User story slicing exercise
User story slicing exerciseUser story slicing exercise
User story slicing exercise
 
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
 
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019Breaking Dependencies Legacy Code -  Cork Software Crafters - September 2019
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
 
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019
 
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
Approval Testing & Mutation Testing - Cork Software Crafters - June 2019
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018
 
Outside-in TDD with Test Doubles
Outside-in TDD with Test DoublesOutside-in TDD with Test Doubles
Outside-in TDD with Test Doubles
 
Angular and Redux
Angular and ReduxAngular and Redux
Angular and Redux
 
Consumer-Driven Contract Testing
Consumer-Driven Contract TestingConsumer-Driven Contract Testing
Consumer-Driven Contract Testing
 
ATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de AceptaciónATDD - Desarrollo Dirigido por Test de Aceptación
ATDD - Desarrollo Dirigido por Test de Aceptación
 
Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4Tests Unitarios con JUnit 4
Tests Unitarios con JUnit 4
 
Gestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBaseGestión de Cambios de BBDD con LiquiBase
Gestión de Cambios de BBDD con LiquiBase
 
Introducción a Spring Roo
Introducción a Spring RooIntroducción a Spring Roo
Introducción a Spring Roo
 

Kürzlich hochgeladen

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Kürzlich hochgeladen (20)

Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 

DDD Strategic Design - Context Maps - Paulo Clavijo - April 2018

  • 1. DDD Strategic Design Introduction to Context Maps Paulo Clavijo - April 2018DDD Guild - GSAD Dell-EMC
  • 2. Domain-driven design - 10000 foot view
  • 3. Strategic Design Ideally, it would be preferable to have a single, unified model. While this is a noble goal, in reality it typically fragments into multiple models. It is useful to recognize this fact of life and work with it. Strategic Design is a set of principles for maintaining model integrity, distillation of the Domain Model and working with multiple models. ● Context ● Distillation ● Large-Scale Structure
  • 5.
  • 6. Problem Space vs Solution Space Sales domain Booking domain Marketing domain Problem Space (real world) Solution Space (domain model) design process Booking context Sales context Marketing context
  • 7. Dom Ap ic o Ser s AP /In ef In as c e Dat e Architecture do mo s he t , al p en po n a d co sa f e c
  • 8. Bounded Context Multiple models are in play on any large project. Yet when code based on distinct models is combined, software becomes buggy, unreliable, and difficult to understand. Communication among team members becomes confusing. It is often unclear in what context a model should not be applied. Therefore: Explicitly define the context within which a model applies. Explicitly set boundaries in terms of team organization, usage within specific parts of the application, and physical manifestations such as code bases and database schemas. Keep the model strictly consistent within these bounds, but don’t be distracted or confused by issues outside. Domain-Driven Design, Eric Evans
  • 9. Bounded Context Bounded Context gives team members a clear and shared understanding of what has to be consistent and what can develop independently Bounded Context Out of context Out of context Ubi o s L u g , un e an l om od Un e n u d o l
  • 10. Bounded Context Large or complex models should be divided into bounded contexts where a model can be explicit by being understood in a specific context. customer message quote quote Sales context Booking context Marketing context notes customer address flight payment method newsletter customer loyalty booking paid flight cancelled booking
  • 11. Big Ball of Mud Bounded Context
  • 12. There is no direct one to one correlation between ● Domain - Context ● Context - Module ● Context - Micro-service Bounded Context
  • 13. Context Map An individual bounded context leaves some problems in the absence of a global view. The context of other models may still be vague and in flux. People on other teams won’t be very aware of the context bounds and will unknowingly make changes that blur the edges or complicate the interconnections. When connections must be made between different contexts, they tend to bleed into each other. Therefore: Identify each model in play on the project and define its bounded context. This includes the implicit models of non-object-oriented subsystems. Name each bounded context, and make the names part of the ubiquitous language. Describe the points of contact between the models, outlining explicit translation for any communication and highlighting any sharing. Map the existing terrain. Domain-Driven Design, Eric Evans
  • 14. Context Map A model is valid in a specific context. Different context might need different version of the model, due to specific purposes. Define Bounded Contexts according to the way things are now. This is crucial. To be effective, the Context Map must reflect the true practice of the teams, not the ideal organization
  • 15. Types of Bounded Context Relationships ● Shared Kernel ● Customer / Supplier ● Conformist ● Anticorruption Layer ● Separate Ways ● Open Host Service ● Published Language
  • 16. Shared Kernel Two teams share a subset of the domain model including code and maybe the database. Teams involved must collaborate, any change in a kernel model must be done only in consultation with the other team. Payroll context employee Employee Management context Em oy o l
  • 17. Customer / Supplier A Customer/Supplier or Consumer-Driven Contract relationship is where the downstream context defines the contract that they want the upstream context to provide. The two domains can still evolve independently, as long as the upstream context fulfills its obligations under the contract. The downstream team, considered as the customer, sometimes has veto rights. Team 1 Team 2
  • 18. Conformist The downstream team conforms to the model of the upstream team. There is no translation of models and not vetoing. If the upstream model is a mess, it propagates to the downstream model. Team 1 Team 2 bar foo bar foo
  • 19. Anticorruption Layer A layer that isolates a client's model from another's system model by translation. Team 1 Team 2 bar foo cat zoo ACL
  • 20. Separate Ways There is no connection between the bounded contexts of a system. This allows teams to find their own solutions in their domain. Team 1 Team 2 pig zoo cat zoo
  • 21. Open Host Service Each Bounded Context offers a defined set of services that expose functionality for other systems. Any downstream system can then implement their own integration. This is especially useful for integration requirements with many other systems. Team 1 Team 2 OHS
  • 22. Published Language Similar to OHS. However it goes as far as to model a Domain as a common language between bounded contexts. Team 1 Team 2 PL Language
  • 23. Context Map - Examples
  • 24. Context Map - Examples
  • 25. Communication between Bounded Contexts ● Interfaces beetween modules (monolith) ● RPC with SOAP ● REST ● Using Events
  • 26. Transfering data between Bounded Contexts
  • 27. References ● Domain-Driven Design. Eric Evans (2003). ● Domain-Driven Design Distilled. Vaughn Vernon (2016). ● Implementing Domain Driven Design. Vaughn Vernon (2013). ● The Anatomy Of Domain-Driven Design. Scott Millett and Samuel Knight. ● Domain Modeling Made Functional. Scott Wlashchin (2018).