Domain Driven Design fundamentals

Preview:

DESCRIPTION

 

Citation preview

"Everythingshouldbemadeass impleaspossible, but not s impler." Albert Einstein

Chaos

Order

Focus

Create a world

with laws

environment Be aware of the

Basic types for the world

Value objects

Value objects • Represents a value

• No identity

• immutable

• Equality by value

good example

...or not

All the same

Entities Meet Bob

Hi, my name is Bob

I'm 32 years old

...and I'm a starshiptrooper

Meet bob

Hi, my name is Bob too

I'm also 32 years old

...and also a starshiptrooper

Identity

Identity • Combination of properties

• Personal number

Aggregate Root

Domain Model by Example

Student

Student

Class

Student

Class Teacher

Student

Class Teacher

Mayor Address

Student

Class Teacher

Mayor Address

Location Material

Student

Class Teacher

Schema Payroll

Mayor Address

Location Material

Student

Class Teacher

Schema Payroll

Mayor Address

Location Material

Student

Class Teacher

Schema Payroll

Mayor Address

Location Material

Student

Class Teacher

Schema Payroll

Mayor Address

Location Material

Student

Class Teacher

Schema Payroll

Mayor Address

Location Material

Validation

Validation

•  Validatable objects

•  !invariant object

Validatable object

•  Default ctor •  Supported by a lot of frameworks •  Flexible

•  Naive

!Invariant object

•  No default ctor, most of the time •  Nonflexible

•  Strict!

dist

ortio

n

Active-Passive

Repositories

Storage

Services Tight, small and focused

Serv

ice

laye

r?

Service layers are c00l •  Support multiple application

•  Your domain is in the center of the world

•  Huge enviroments

•  Read DTO's •  Write command

Service layers are bad, mkay •  Domain logic is boxed

•  Logic duplication

•  No direct feedback

•  Databinding support!

Bootstrapping

Overview

Domain

Domain

DB

Domain UI

DB

Domain UI

Storage

Service DB

Domain UI

Storage

Service DB

Logging

Domain Service bus UI

Logging

Storage

Service DB

Domain Service bus UI

Logging

Storage

Service DB

Domain Service bus

UI model

Logging

Storage

Service DB

UI

Beheer

Domain Service bus

UI model

Logging

Storage

Service DB

UI

Beheer

WCF

Inversion of control You only want beer

Learn more

DISCUSSION

You were great! Really, I already knew it when creating this slide