www.lilobase.me
The strategies
behind DDD
@lilobase
#DevSummit
sundayapp.com
Slide 2
Slide 2 text
Let’s start a new project !
Slide 3
Slide 3 text
Sprint Zero
Java or C# ?
Spring Boot or
Quarkus ?
Kafka
or Redis ?
Microservices
or Monolith ?
Kubernetes
or Nomad ?
Angular
or React ?
Slide 4
Slide 4 text
Look, at our spring
boot application with
Kafka deployed on a K8S
Cluster
They know nothing
about the project’s business
domain
…
Sprint Zero
Slide 5
Slide 5 text
Java or C# ?
Spring Boot or
Quarkus ?
Kafka
or Redis ?
Microservices
or Monolith ?
Kubernetes
or Nomad ?
Angular
or React ?
These issues address only
the solution
Slide 6
Slide 6 text
But not the problem
What should we do ?
…
Slide 7
Slide 7 text
Spring Boot or
Quarkus ?
Kafka
or Redis ?
Microservices
or Monolith ?
Kubernetes
or Nomad ?
Angular
or React ?
And that's why we
are seen as technical expert
Java or C# ?
Slide 8
Slide 8 text
solution
problem
What should we do ?
How are we going to do it ?
It is an important discussion to have
But only after we've
fi
gured out
what to do
Slide 9
Slide 9 text
DDD is all about
Alignment
What should we do ?
How are we going to do it ?
Slide 10
Slide 10 text
DDD is all about
Alignment
What should we do ?
How are we going to do it ?
Slide 11
Slide 11 text
« Give a child a hammer and
everything they meets has to be
pounded. »
– Abraham Kaplan
Slide 12
Slide 12 text
« We put the needs
of the database
before the needs of
the users, which
results in some
pretty crappy
experiences »
– @WalterStephanie
Slide 13
Slide 13 text
www.lilobase.me
DDD is all about
Understanding
@lilobase
Slide 14
Slide 14 text
Domains & Subdomains
Business Domain discovery
THE software
Slide 15
Slide 15 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
&
Publishing
Customer Care
Printing &
Supply Chain
Retail Store
You need to acknowledge the fact that
you have several domains
Slide 16
Slide 16 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
&
Publishing
Customer Care
Printing &
Supply Chain
Retail Store
Only one VP should be
angry at a time
Slide 17
Slide 17 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
&
Publishing
Customer Care
Printing &
Supply Chain
Retail Store
These are neither Bounded
Contexts nor Microservices
Slide 18
Slide 18 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
&
Publishing
Customer Care
Printing &
Supply Chain
Retail Store
These are your domains
Slide 19
Slide 19 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
&
Publishing
Customer
Care
Printing &
Supply Chain
Online Retail Store
Payment
processor
Catalogue Invoicing
Your domains contain domains
Slide 20
Slide 20 text
Supporting
Subdomain
Generic
Subdomain
Core
(sub)Domain
Key differentiator
Domains & Subdomains
Business Domain Classi
fi
cation
Essential to the
organization’s success
Required for the
organization’s success
Critical to the
organization’s success
Slide 21
Slide 21 text
Domain Mapping
Business Domain Classi
fi
cation
Authoring
Plateform
Publishing &
Printing
Inventory
Management
Payment
Processor
Catalogue
Invoicing
Shipping
Order
Processing
Proofreading
Slide 22
Slide 22 text
Domains & Subdomains
Business Domain Classi
fi
cation
Authoring
Plateform
Inventory
Management
Shipping
Payment
Processor
Catalogue
Invoicing
Order
Processing
Publishing &
Printing
Proofreading
Slide 23
Slide 23 text
Domains & Subdomains
Business Domain Classi
fi
cation
Authoring
Plateform
Inventory
Management
Payment
Processor
Catalogue
Invoicing
Each business context is speci
fi
c
Shipping
Order
Processing
Publishing &
Printing
Proofreading
Slide 24
Slide 24 text
Authoring
Plateform
Domains’ Connexion
Reveal Business Relationships
Inventory
Management
Shipping
Catalogue
Invoicing
Order
Processing
Payment
Processor
It can highlight signi
fi
cant
sub-domain
Publishing &
Printing
Proofreading
Slide 25
Slide 25 text
www.lilobase.me
DDD is all about
Context
@lilobase
Slide 26
Slide 26 text
From Problem to Solution
Authoring
Plateform
Publishing
& Printing
Inventory
Management
Shipping
Payment
Processor
Catalogue
Invoicing
Order
Processing
Proofreading
Slide 27
Slide 27 text
From Problem to Solution
Authoring
Plateform
Publishing
& Printing
Inventory
Management
Shipping
Payment
Processor
Catalogue
Invoicing
Order
Processing
problem
solution
Payment
processor
Invoicing
Order
Processing
Shipping
Authoring
Plateforme
Inventory
Management
Catalogue
Publishing
Proofreading
Proofreading
Inventory E-commerce platform
Authoring
Publishing
Slide 28
Slide 28 text
Domains & Subdomains
Development Strategy
Supporting
Subdomain
In-House development with
external support if possible
Generic
Subdomain
Outsourcing is an option
Core
(sub)Domain
In-House development
with Your best teams
Key differentiator
Slide 29
Slide 29 text
Domains & Subdomains
Development Strategy
Supporting
Subdomain
Customized Off The Shelf Software
is an option
Generic
Subdomain
Try to
fi
nd Off The Shelf solution
Cost saving opportunities
Core
(sub)Domain
Custom-made software
High Cost & Quality
Key differentiator
Slide 30
Slide 30 text
From Problem to Solution
Payment
processor
Invoicing
Order
Processing
Shipping
Authoring
Plateforme
Inventory
Management
Catalogue
Publishing
Proofreading
Inventory E-commerce platform
Authoring
Publishing
Authoring
Plateform
Publishing
& Printing
Inventory
Management
Shipping
Payment
Processor
Catalogue
Invoicing
Order
Processing
Proofreading
Slide 31
Slide 31 text
From Problem to Solution
Inventory E-commerce platform
Authoring
Authoring
Plateforme Publishing
Catalogue
Publishing
Proofreading
Authoring
Plateform
Publishing
& Printing
Inventory
Management
Shipping
Payment
Processor
Catalogue
Invoicing
Order
Processing
Proofreading
Slide 32
Slide 32 text
From Problem to Solution
Business Domain & Architecture alignment
Inventory E-commerce
platform
Authoring
Authoring
Plateforme Publishing
Catalogue
Publishing
Proofreading
These are your bounded contexts
Slide 33
Slide 33 text
Inventory E-commerce
platform
Authoring
Publishing
Align your teams with your
bounded context
« Team assignments are the
fi
rst
draft of the architecture »
– Michael Nygard
Authoring
Publishing
E-commerce
Specific Architecture style
You don’t need one architectural style
Beware of the CRUD
ES
CQRS
CRUD ?
Stripe
ShipMonk Shopify
Slide 36
Slide 36 text
Stripe
Still no microservices
Bounded Context ≠ Deployment units
ShipMonk
Authoring
Publishing
E-commerce
Shopify
Deployment Unit
Slide 37
Slide 37 text
Deployment Unit
Stripe
Still no microservices
Bounded Context ≠ Deployment units
ShipMonk
Authoring
Publishing
E-commerce
Shopify
Deployment Unit
Slide 38
Slide 38 text
Domains are not immutable
Understanding is a never-ending process
Stripe
ShipMonk
Authoring
Publishing
E-commerce
Shopify
Printing
Slide 39
Slide 39 text
www.lilobase.me
DDD is all about
Boundaries
@lilobase
Slide 40
Slide 40 text
Semantic Boundaries
Between BC meaning are different
Authoring Publishing
Book
Chapter
Chapter
They are not the same book
What
happens if
the author
revises his
book?
Slide 41
Slide 41 text
Semantic Boundaries
Between BC meaning are different
Chapter
This is why you must start by understand
strategically your domain
Author
Book
Reviews
Release
Catalogue
Slide 42
Slide 42 text
Semantic Boundaries
Between BC meaning are different
Authoring Publishing
Book
Chapter
Chapter
Book
Chapter
Chapter
Inside a
Bounded
Context,
Don’t
Repeat
Yourself
Between
Bounded
Context,
Write
Everything
Twice
Slide 43
Slide 43 text
Don’t cross them
Between BC meaning are different
Authoring Publishing
Author
Reviews
Author
Book Book
Release
Never create relationships
between entities from two BC
Slide 44
Slide 44 text
Don’t cross them
Between BC meaning are different
Authoring Publishing
Book Book
Release
Author
Author
Reviews
This is exactly the same
Slide 45
Slide 45 text
Don’t cross them
Between BC meaning are different
Authoring Publishing
Book Book
Release
Author
Author
Reviews
API API
Slide 46
Slide 46 text
Same for Events
Between BC meaning are different
Authoring Publishing
This is exactly the same
Event
Bus
Book Book
Release
Author
Author
Reviews
Slide 47
Slide 47 text
Same for Events
Between BC meaning are different
Authoring Publishing
Event
Bus
Book Book
Release
Author
Author
Reviews
Translator Translator
Slide 48
Slide 48 text
Transactional Boundaries
Protect your integrity
Authoring
Book
Chapter
Chapter
Chapter
Statistics
Inside your
bounded
Context
live
Entities
They are
grouped in
Aggregates
Slide 49
Slide 49 text
Transactional Boundaries
Protect your integrity
Book
Chapter
Chapter
Chapter
Statistics
They are
retrieved
and
persisted
as a whole
Inside an
aggregate,
Entities
share the
same
lifecycle
Slide 50
Slide 50 text
Transactional Boundaries
Protect your integrity
Book
Chapter
Chapter
Chapter
Statistics
Who
ensures the
aggregate
integrity
All
interactions
are done
through the
Aggregate
Root
Write a new chapter
Slide 51
Slide 51 text
Transactional Boundaries
Protect your integrity
Book
Chapter
Chapter
Chapter
Statistics
Write a new chapter
Chapter
Inconsistency
Slide 52
Slide 52 text
Transactional Boundaries
Protect your integrity
Book
Chapter
Chapter
Chapter
Statistics
But don’t
put to much
in it
Author
What
happens if
we delete
the book ?
They must share the same lifecycle
Slide 53
Slide 53 text
Transactional Boundaries
Protect your integrity
Book
Chapter
Chapter
Chapter
Statistics
Author
reference
Author
Id
Slide 54
Slide 54 text
Designing Boundaries
Protect your domain
Printing Team
We need printing
margin
Book
Chapter
Chapter
Chapter
Release
We need the
colorimetric pro
fi
le
Printing
margin
Colorimetric
pro
fi
le
API
Publishing Team
Slide 55
Slide 55 text
Designing Boundaries
Protect your domain
API
We need printing
margin
Book
Chapter
Chapter
Chapter
Release
We need the
colorimetric pro
fi
le
Printing
margin
Colorimetric
pro
fi
le
Domain Leakage
Publishing Team Printing Team
Slide 56
Slide 56 text
Designing Boundaries
Protect your domain
Publishing Team Printing Team
Publishing
API
We need
printing margin
Book
We need the
colorimetric
pro
fi
le
Printing
margin
Colorimetric
pro
fi
le
Printing API
We discovered the need
for an ACL
Slide 57
Slide 57 text
www.lilobase.me
DDD is all about
Behavior
@lilobase
Slide 58
Slide 58 text
CRUD don’t express behavior
It blinds you from the business perspective
UPDATE address
Relocation Mistake correction
Slide 59
Slide 59 text
CRUD don’t express behavior
It blinds you from the business perspective
Relocation Mistake correction
Slide 60
Slide 60 text
Data oriented programming
It obfuscates your code
– Mathias Verraes
$order->setStatus('paid');
$order->setPaidAmount(120);
$order->setPaidCurrency('EUR');
$order->setCustomer($customer);
Slide 61
Slide 61 text
Data oriented programming
It obfuscates your code
$money = new Money(120, new Currency(‘EUR'));
$order->pay($customer, $money);
– Mathias Verraes
$customer->pay($order, $money);
Slide 62
Slide 62 text
Data oriented programming
It obfuscates your code
– Mathias Verraes
$customer->pay($order, $money);
$order->setStatus('paid');
$order->setPaidAmount(120);
$order->setPaidCurrency('EUR');
$order->setCustomer($customer);
Slide 63
Slide 63 text
Task Based UI
Your customer’s need isn’t to
fi
ll out forms
Slide 64
Slide 64 text
Users don’t need to fill out forms
Slide 65
Slide 65 text
Users don’t need to fill out forms
Slide 66
Slide 66 text
www.lilobase.me
DDD is all about
Compassion
@lilobase
Slide 67
Slide 67 text
A A
A
Ubiquitous language
Stakeholders & Team Alignement
Dev Domain
Expert
Dev
Slide 68
Slide 68 text
A A
A
not « just » a glossary
Ubiquitous language
Stakeholders & Team Alignement
Dev Domain
Expert
Dev
Slide 69
Slide 69 text
Ubiquitous language
Each BC has its own
Authoring Publishing
A A
Slide 70
Slide 70 text
Ubiquitous language
Each BC has its own
Authoring Publishing
A A
A A
It is a common cause of
miscommunication
Slide 71
Slide 71 text
Pair Programing
The best way to share a domain understanding
Dev Domain
Expert
Slide 72
Slide 72 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
Slide 73
Slide 73 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
He has the last word regarding
domain implementation
Slide 74
Slide 74 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
Prioritize development &
formalize users’ feedback
Slide 75
Slide 75 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
Power of Life and Death over the
project
Slide 76
Slide 76 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
Too often forgotten
Slide 77
Slide 77 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
Maybe you could spend a day per
month working with them ?
Slide 78
Slide 78 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
They design the software
speci
fi
cation
Slide 79
Slide 79 text
Know your users
They might not be who you think they are
Dev Domain
Expert
Product
Owner
Customer User
What he understood goes
into production
Slide 80
Slide 80 text
www.lilobase.me
DDD is for every
Projects
@lilobase
Slide 81
Slide 81 text
“A loosely coupled software
architecture and org
structure to match” is a key
predictor of:
• Continuous Delivery
Performance
• Ability to scale
organization and increase
performance linearly
This is what DDD is All About !
— Michael Plöd (@bitboss)