87
Not all of a large system will be well designed.

Domain-Driven Design: The tutorial

Embed Size (px)

Citation preview

Page 1: Domain-Driven Design: The tutorial

Not all of a large system will be well designed.

Page 2: Domain-Driven Design: The tutorial

Strategic Design

Partnered in Scandinavia with

Eric Evans

Making Models Work in Large Projects

Eric EvansDomain Language, Inc.

Page 3: Domain-Driven Design: The tutorial

Not all of a large system will be well designed.

Page 4: Domain-Driven Design: The tutorial

Ground Up Rebuild

Page 5: Domain-Driven Design: The tutorial

Ground Up Rebuild

Page 6: Domain-Driven Design: The tutorial

Ground Up Rebuild

Page 7: Domain-Driven Design: The tutorial

Ground Up Rebuild

Year 1

Year 2

Year 3

Legacy Replaced

Exciting New Features

Page 8: Domain-Driven Design: The tutorial

Let’s Refactor

Page 9: Domain-Driven Design: The tutorial

Let’s Refactor

Page 10: Domain-Driven Design: The tutorial

domain A sphere of knowledge, influence, or activity.

Define Domain

Page 11: Domain-Driven Design: The tutorial

domain A sphere of knowledge, influence, or activity.

The subject area to which the user applies a program is the domain of the software.

Define Domain

Page 12: Domain-Driven Design: The tutorial

Why bother with models?

Page 13: Domain-Driven Design: The tutorial

The critical complexity of most software projects is in understanding the domain itself.

Critical Complexity Is

Page 14: Domain-Driven Design: The tutorial

What is a model?

Page 15: Domain-Driven Design: The tutorial

origindestinationcustoms clearance (opt)

Route Specification

Itinerary

{ordered}

*

0..1

{Itinerary must satisfy specification}

Routing Servicea Route Specification

an Itinerary satisfyingthe RouteSpecification

Cargo

vessel Voyage IDload dateload locationunload dateunload location

Leg

Page 16: Domain-Driven Design: The tutorial

Chinese Map

Page 17: Domain-Driven Design: The tutorial

Mercator Map

Page 18: Domain-Driven Design: The tutorial

model A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain.

Define Model

Page 19: Domain-Driven Design: The tutorial

model A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain.

Define Model

Page 20: Domain-Driven Design: The tutorial

model A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain.

Define Model

Page 21: Domain-Driven Design: The tutorial

A Model Serves a Particular Use.

Page 22: Domain-Driven Design: The tutorial

A Model Serves a Particular Use.

• Not “as realistic as possible”

Page 23: Domain-Driven Design: The tutorial

A Model Serves a Particular Use.

• Not “as realistic as possible”

• Useful relative to specific set of domain scenarios

Page 24: Domain-Driven Design: The tutorial

ubiquitous languageA language structured around the domain model and used by all team members to connect all the activities of the team with the software.

Define Ubiquitous Language

Page 25: Domain-Driven Design: The tutorial

context The setting in which a word or statement appears that determines its meaning.

Define Context

Page 26: Domain-Driven Design: The tutorial

There are always multiple models.

Page 27: Domain-Driven Design: The tutorial
Page 28: Domain-Driven Design: The tutorial
Page 29: Domain-Driven Design: The tutorial
Page 30: Domain-Driven Design: The tutorial
Page 31: Domain-Driven Design: The tutorial
Page 32: Domain-Driven Design: The tutorial

Rowing 8

Page 33: Domain-Driven Design: The tutorial

“Context Map”

Page 34: Domain-Driven Design: The tutorial

communications commitment/capability of team(s)

cont

rol o

f all

asso

ciat

ed s

yste

ms

SEPARATE WAYS

ANTI-CORRUPTIONLAYER

Single BOUNDEDCONTEXT

CUSTOMER/SUPPLIER TEAMS

SHARED KERNEL

CONFORMIST

OPEN HOSTSERVICE

Page 35: Domain-Driven Design: The tutorial

communications commitment/capability of team(s)

cont

rol o

f all

asso

ciat

ed s

yste

ms

SEPARATE WAYS

ANTI-CORRUPTIONLAYER

Single BOUNDEDCONTEXT

CUSTOMER/SUPPLIER TEAMS

SHARED KERNEL

CONFORMIST

OPEN HOSTSERVICE

cooperative upstream/downstream

Page 36: Domain-Driven Design: The tutorial
Page 37: Domain-Driven Design: The tutorial

communications commitment/capability of team(s)

cont

rol o

f all

asso

ciat

ed s

yste

ms

SEPARATE WAYS

ANTI-CORRUPTIONLAYER

Single BOUNDEDCONTEXT

CUSTOMER/SUPPLIER TEAMS

SHARED KERNEL

CONFORMIST

OPEN HOSTSERVICE

uncooperative upstream/downstream

Page 38: Domain-Driven Design: The tutorial
Page 39: Domain-Driven Design: The tutorial
Page 40: Domain-Driven Design: The tutorial

Custom House Currency Exchange System

early 2006

Page 41: Domain-Driven Design: The tutorial

Custom House Context Map

SPOT

TBS

Page 42: Domain-Driven Design: The tutorial

Custom House Context Map

SPOT

TBS

D

U

Page 43: Domain-Driven Design: The tutorial

Custom House Context Map

SPOT

TBS

D

U

Page 44: Domain-Driven Design: The tutorial

Custom House “SPOT” Modelof Currency Exchange Deal

Page 45: Domain-Driven Design: The tutorial

Object Interpretation of Implicit “TBS” Model

Page 46: Domain-Driven Design: The tutorial

Explicit Translation

Page 47: Domain-Driven Design: The tutorial

Custom House Currency Exchange System

late 2006

Page 48: Domain-Driven Design: The tutorial

Map What Is

Page 49: Domain-Driven Design: The tutorial

Push Translation to the Borders

Page 50: Domain-Driven Design: The tutorial

Single, Unified Model within Any One Context

Page 51: Domain-Driven Design: The tutorial

Single, Unified Model within Any One Context

(Where careful design is going on.)

Page 52: Domain-Driven Design: The tutorial

Single, Unified Model within Any One Context

No duplication...

Page 53: Domain-Driven Design: The tutorial

Single, Unified Model within Any One Context

No duplication...within a context!

Duplication between...

Page 54: Domain-Driven Design: The tutorial

Single, Unified Model within Any One Context

No duplication...within a context!

Duplication between...AOK!

Page 55: Domain-Driven Design: The tutorial
Page 56: Domain-Driven Design: The tutorial

Ground Up Rebuild

Page 57: Domain-Driven Design: The tutorial

Let’s Refactor

Page 58: Domain-Driven Design: The tutorial

The Enterprise Model

One Ring to rule them all, One Ring to find them, One Ring to

bring them all, and in the darkness bind them

Page 59: Domain-Driven Design: The tutorial

Not all of a large system will be well designed.

Page 60: Domain-Driven Design: The tutorial

Distilling the Core Domain

Page 61: Domain-Driven Design: The tutorial

Distilling the Core Domain

Generic Subdomains

Page 62: Domain-Driven Design: The tutorial

Distilling the Core Domain

Generic Subdomains

Supporting Subdomains

Page 63: Domain-Driven Design: The tutorial

Distilling the Core Domain

Generic Subdomains

Supporting Subdomains

Core Domain

Page 64: Domain-Driven Design: The tutorial

Distilling the Core Domain

– What makes your system worth writing?

Page 65: Domain-Driven Design: The tutorial

Distilling the Core Domain

– What makes your system worth writing?

– Why not buy it off the shelf?

Page 66: Domain-Driven Design: The tutorial

Distilling the Core Domain

– What makes your system worth writing?

– Why not buy it off the shelf?

– Why not outsource it?

Page 67: Domain-Driven Design: The tutorial

Distilling the Core Domain

– What makes your system worth writing?

– Why not buy it off the shelf?

– Why not outsource it?

Page 68: Domain-Driven Design: The tutorial

Effort Distribution

Page 69: Domain-Driven Design: The tutorial

Effort Distribution

Page 70: Domain-Driven Design: The tutorial

Effort Distribution

Page 71: Domain-Driven Design: The tutorial

Effort Distribution

Page 72: Domain-Driven Design: The tutorial

Ground Up Rebuild

Year 1

Year 2

Year 3

Legacy Replaced

Exciting New Features

Page 73: Domain-Driven Design: The tutorial

Which Part is Core?

Page 74: Domain-Driven Design: The tutorial

Which Part is Core?

Page 75: Domain-Driven Design: The tutorial

Responsibility Traps

…Or, Why do irresponsible programmers become heroes?

Page 76: Domain-Driven Design: The tutorial

Let’s Hack

Page 77: Domain-Driven Design: The tutorial

Let’s Hack

Page 78: Domain-Driven Design: The tutorial

Which Parts are Core?

Page 79: Domain-Driven Design: The tutorial

Which Parts are Core?

Page 80: Domain-Driven Design: The tutorial

Responsibility Traps

• Building a platform to make other (lesser) programmers more productive.

• Cleaning up other people’s mess.

Page 81: Domain-Driven Design: The tutorial

What’s a responsible designer to do?!!

Page 82: Domain-Driven Design: The tutorial

How could we just build the core part?

Page 83: Domain-Driven Design: The tutorial

Build Platform Based on Model

Page 84: Domain-Driven Design: The tutorial

Build Platform Based on Model

Page 85: Domain-Driven Design: The tutorial

Strategy

• Draw a Context Map.• Work with business leadership to define

Core Domain.• Design a platform that supports work in

the Core Domain.• Work with management to give freedom to

the Core Domain Platform Context.• Develop and model in the Core Domain.

Page 86: Domain-Driven Design: The tutorial

Strategy

• Keep an eye on your Context Map.• Keep working with business leadership as

Core Domain narrows and shifts.• Guard your platform that supports work in the

Core Domain.• Keep working with management to maintain

freedom of the Core Domain Platform Context.• Keep developing and evolving the model in the

Core Domain.

Page 87: Domain-Driven Design: The tutorial

Strategic DDD Resources

www.domaindrivendesign.org

Domain-Driven Design by Eric Evans

PART 4!

www.domainlanguage.com