ddd boundaries & responsibilities

29
Boundaries & Responsibilities: Teams, Apps, API and Data

Upload: dennis-loktionov

Post on 21-Jun-2015

552 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Ddd   boundaries & responsibilities

Boundaries & Responsibilities:Teams, Apps, API and Data

Page 2: Ddd   boundaries & responsibilities

Agenda

• Strategic Design

• Bounded Context and Context Maps

• Integration Strategies & Recipes

• Data Ownership

• Integrity & Consistency

• Duplication

Page 3: Ddd   boundaries & responsibilities

Strategic Design

Why?

• Scaling up complex domain models

• Total unification of the domain model for a large system

will not be feasible or cost-effective

• Modularity without losing benefits of integration

Page 4: Ddd   boundaries & responsibilities

Design and Politics Often Intersect

Page 5: Ddd   boundaries & responsibilities

Strategic Design

What?

• Need for a systematic, evolving design strategy

• Doesn’t happen by itself or through good intentions

• Proactive decisions about what should be unified

• Pragmatic recognition of what’s not unified

Page 6: Ddd   boundaries & responsibilities

Bounded Context

• Defines the range of applicability of each domain model

• Multiple models coexist and apply in different contexts

• Defines consistency boundaries

Page 7: Ddd   boundaries & responsibilities

Bounded Context

Page 8: Ddd   boundaries & responsibilities

Bounded Context Not Defined

• Unclear in what context model should be applied

• Unclear in what context model should not be applied

• Lack of focus and confusion by issues outside

Page 9: Ddd   boundaries & responsibilities

Bounded Context

How?

• Explicitly define a scope of a particular model

• Explicitly set boundaries

• Team organization

• Usage within a specific application

• Physical manifestation (codebase and DB schema)

Page 10: Ddd   boundaries & responsibilities

Bounded Context

Clarity & Freedom

• Keep the model consistent within its bounds

• Team responsible for the model deals with the whole

lifecycle of each object, including persistence

• Teams don’t get distracted or confused by issues outside

Page 11: Ddd   boundaries & responsibilities

Recognizing Splinters

Indicators

• Confusion of domain language

• Code interfaces don’t match up

• Duplicate concepts

• False cognates

Page 12: Ddd   boundaries & responsibilities

Context Map

• Project’s contexts

• Relationships between contexts

Page 13: Ddd   boundaries & responsibilities

Context Map

• Identify each Model on the project

• Define Bounded Context

• Name each Bounded Context

• Describe points of contact between models

• Outline explicit translation

• Highlight any sharing

Page 14: Ddd   boundaries & responsibilities

Context Map

Reflects:

• Team structure

• Management structure

• Product strategy

• Timelines

• Trust

• Physical office space

Page 15: Ddd   boundaries & responsibilities

Context Map

Page 16: Ddd   boundaries & responsibilities

MAP THE TERRAIN!

Page 17: Ddd   boundaries & responsibilities

Context Map

Page 18: Ddd   boundaries & responsibilities

Context Map

• Bounded Contexts partition should be based on cost-

benefit trade-off:

• Independent team action

• Direct and rich integration

Page 19: Ddd   boundaries & responsibilities

Larger Bounded Context

• Flow between user tasks is smoother (unified model)

• Coherent and easy-to-understand model instead of two

distinct ones plus mapping

• Translation between two models can be difficult

• Shared language fosters clear team communication

Page 20: Ddd   boundaries & responsibilities

Smaller Bounded Context

• Communication overhead between developers is

reduced

• Continuous integration is easier with smaller teams and

code bases

• Different models can cater to special needs

• Ubiquitous language dialects can be encompassed by

smaller models

Page 21: Ddd   boundaries & responsibilities

Technical Considerations

• Deployment

• Versioning and backwards compatibility

• Data migration

• Environments

Page 22: Ddd   boundaries & responsibilities

Integration Strategies and Recipes

• Shared Kernel

• Customer/Supplier

• Conformist

• Open Host

• Published Language

• Anticorruption Layer

• Separate Ways

Page 23: Ddd   boundaries & responsibilities

Integration Strategies and Recipes

Page 24: Ddd   boundaries & responsibilities

DECISIONS ARE NOT

IRREVERSIBLE

Page 25: Ddd   boundaries & responsibilities

Data Ownership

• Data Integrity

• Data Duplication

Page 26: Ddd   boundaries & responsibilities

Data Duplication

Is data duplication BAD?

Page 27: Ddd   boundaries & responsibilities

Data Duplication

• Staleness

• Inconsistency

Page 28: Ddd   boundaries & responsibilities

Data Duplication

The data may be stale…

but is that really an issue?

Page 29: Ddd   boundaries & responsibilities

Data Integrity

• Different data has different requirements

• Product Specifications

• Product Assets

• Product Pricing

• Product Recommendations

• Cost-benefit analysis