ddd basics: bounded contexts, modelling - kortrijk edition

38

Click here to load reader

Upload: mathiasverraes

Post on 11-May-2015

738 views

Category:

Software


0 download

DESCRIPTION

Two of the six modules of the @DDDBE meetup on Strategic Domain-Driven Design on June 10, 2014 at Stack & Heap 1. Bounded Contexts 2. Modelling More at http://verraes.net/ or http://twitter.com/mathiasverraes

TRANSCRIPT

Page 1: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

DDD Basics - Kortrijk EditionJune 10, 2014 - Belgium

@DDDBE — http://domaindriven.be

Page 2: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Kindly hosted by

Page 3: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

We’ve got some great (international) speakers, but we need locations!

ping @DDDBE

http://domaindriven.be

Page 4: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Aspects of Domain-Driven Design

Page 5: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Tactical DDD !

design patterns

Page 6: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Collaborative DDD !

model storming

Page 7: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Strategic DDD !

complexity, scale

Page 8: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Defining DDD (Yves) Ubiquitous Language (Jef)

Bounded Contexts (Mathias) Context Mapping (Stijn)

Modelling (Mathias) Starting/Selling DDD (Tom)

Q&A / Lean Coffee

Page 9: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Bounded Contexts

Page 10: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

“When something is wrong,

something is too big.”

— Leopold Kohr

Page 11: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Large complex systems:

harder to reason about

Page 12: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Large complex systems:

your mental model !=

my mental model

Page 13: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Large complex systems:

subtle nuances in meaning

Page 14: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Avoid a big unified centralised model.

Page 15: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Classic example: What is a product?

Page 16: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Split into Bounded Contexts

Page 17: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Make Bounded Context explicit pure

independent consistent within its

boundary

Page 18: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Benefits: clarity

model integrity freedom to

evolve separately

Page 19: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Drawbacks: short term convenience choosing the boundaries how big is the problem?

Page 20: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Tricks

Page 21: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Inspired by departments

teams life cycles

business processes

Page 22: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

What if this was an off-the-shelf solution?

Page 23: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

How much communication goes on

between Bounded Contexts?

Page 24: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Visualize! !

Context Mapping Model Storming

Page 25: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Modelling

Page 26: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Structural modelling

describes state

Page 27: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Structural modelling

inspired by persistence concerns

Page 28: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Relational Normalised

CRUD Anaemic

Page 29: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

“CRUD is our industry’s

grand failure.”

— Greg Young

Page 30: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Ask your Domain Expert

about State Changes!

Page 31: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Why does it change? When does it change?

How often? Who causes it? By which rules?

What consequences?

Page 32: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

!

!

The moving parts are more interesting than the

stable parts

Page 33: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

!

!

A Domain Model is about:

Page 34: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

state + structure behaviour + change

temporal roles + actors

business rules + invariants causality + correlation

interaction processes

workflows + transitions intention + consequence

failure …

Page 35: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Modelling: Make the implicit explicit

Page 36: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

example !

Intentions: Command Objects

Consequences: Domain Events

Page 37: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Intention

ProtectionInterpretation

Automation

user sends Commands

manage processes

domain model sends Events,

guards consistency

create read models from Events

DTO

Commands

Even

ts

Page 38: DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

@mathiasverraes http://verraes.net