SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
Domain-Driven Design
Focus on Knowledge, Efficiency and Maintainability
Gérard Dethier1
1
Guardis / ComodIT
http://www.comodit.com
November 10th 2017 / Geeks Anonymes Liège
Most IT systems consist in the implementation of a set of
processes
For instance, a company selling failure-prone products to coyotes:
registration of a new client
selling
billing
. . .
Many implemented processes share the same structure
Read some stuff from a database
Modify parts of retrieved information while enforcing some rules
Save the modified parts into the database
While structure is simple, details can be complex
When selling an Item to a Client, first check that there are
enough Units available. If it’s the case, remove the Item from
the Stock. If the number of Units in Stock goes below a
given Threshold, the production of new Units should be
triggered. Also, a Line should be added to the last Invoice
not yet emitted. Finally, as soon as the Item is shipped, an
e-mail should be sent to the Coyote.
– An ACME domain expert
Details may change in time
Agile project management implies ever changing requirements
The domain is evolving
Domain experts and developers are not talking the same
language
Domain experts are talking about clients, units, stock,
invoices, . . .
Developers are talking about tables, records, objects, classes,
relations, transactions. . .
. . . and that’s perfectly fine (both languages are the most efficient
when used in their context)!
A common language is needed
Understood by both domain experts and developers
Precise
Flexible
Scalable in domain complexity
The number of processes executed per time unit can be
large
For example, ACME faces:
A growth in client base → many registrations
many orders
many invoices
. . .
Slow execution has a cost
For example:
Less registrations means less clients
Slow invoicing has a bad impact on cash flow
Slow client support might lead to clients leaving
Note that the cost is not necessarily money
Processes execution time must be low
Implementation must be:
Efficient
Scalable
Developers team evolves
Developers might leave → potential loss of knowledge
Team might grow to better respond to change → collaboration
between developers becomes more complex (knowledge
exchange, collisions in code changes. . . )
Domain-Driven Design (DDD) is a framework addressing all
those concerns
Provides a meta-language for domain experts and developers
easing the definition of a common language
Includes the domain description in the code
Defines design rules promoting flexible, efficient and scalable
code, as well as improving collaboration between developers
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
DDD defines a meta-language that can be used to develop a
common language between domain experts and developers
The meta-language looks like other well known “languages”
(OOP, ER model) but is more abstract
The Ubiquitous Language defines the vocabulary that domain
experts and developers will use in their communication and in the
code
10 design element types are available
The Value Object (VO) has a state that does not evolve in
time
It has no identity and is only defined by its value
It’s state is immutable
It can have a behavior (it’s a good practice to put as much
knowledge as possible in VOs)
Examples: contact name, e-mail address, invoice number, . . .
The Entity has a life cycle and an identity
Its state may evolve over time
It is uniquely identified by a key
It’s state is, in general, made of a set of VOs
It may reference other Entities
The Aggregate defines a group of tightly coupled Entities
One single Entity has the role of Aggregate Root
it’s identity is the Aggregate’s identity
it acts as an entry point to Aggregate’s behavior
A set of invariants applies to the Entities part of the Aggregate
No reference can point to any Entity of an Aggregate except the
Aggregate Root
Aggregates are built using Factories
A Factory is stateless
Built Aggregates have all their invariants fulfilled
Aggregates are stored using Repositories
A Repository is stateless
Repositories expose a collection-like interface to perform CRUD
operations
Repositories hide the details of Aggregates’ storage
A behavior not finding its place in any of previous elements
is put in a Service
A Service is stateless (Repositories and Factories are particular
cases of Services)
The choice of putting behavior in a Service rather than in a VO,
Entity, Repository or Factory must be driven by the domain
Modules allow to organize a domain when the number of
elements grows
The only purpose is organization
No behavior
No state
When sub-domains are identified, they can be mapped to
separate Bounded Contexts
A Bounded Context defines a bounday in which a concept has a
unique definition
The same concept can appear in different Bounded Contexts but
with varying definitions
Bounded Contexts generally map to separate pieces of a system
that model a given domain
The Context Map shows the way Bounded Contexts are
linked
A link between 2 Bounded Contexts means they share related
concepts
Links can be annotated with the related concepts
Only one Aggregate can be updated per transaction
The Aggregate Root is acting as the “lock”
At the end of the transaction, all invariants must be true
Domain Events allow consistency rules spanning several
Aggregates
The update of one Aggregate triggers the publication of a Domain
Event
The Domain Event consumption implies the update of another
Aggregate in another transaction
After a sequence of transactions, all invariants are verified
This is called Eventual Consistency
Design elements can be categorized
Stateful Behavioral Stuctural
Value Object • •
Entity • •
Aggregate •
Factory •
Repository •
Service •
Module •
Bounded Context •
Context Map •
Domain Event •
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
Information is spread among elements with varying precision
The structure of the model makes search efficient for
everybody
Tree search → O(logn)
Domain experts and developers understand the model (they built
it together!)
The type of design elements tells if one might find a given type of
information or not (state / behavior / structure)
Deepening of the model does not get crippled by existing
complexity
. . . if information is evenly spread across leaves
→ VOs and Entities are the best places to store information
It is then possible to focus on small pieces of the domain that
need to be deepened
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
Domain experts are generally open to delay the fulfillment of
some constraints
Acceptable delays may vary between a couple of seconds and
days!
Eventual Consistency can therefore be used in a lot of situations,
in particular when fast response time is needed
Small Aggregates are desirable
Smaller (in terms of number of elements) Aggregates → shorter
transactions
Short transactions
→ improved scalability
→ reduced risk of conflict
Perceived execution time for a process → short as only first step
is blocking (following steps run in background)
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
The model is documented by the code
Discussions between domain experts and developers can be put
in the context of actual code as both share a Ubiquitous
Language
No risk of stale external documentation obfuscating the model
A domain expert is actually able to help a developer understand
its own code!
Clear separation of concerns allows parallel improvement of
the model
Several teams can work in parallel on separate Bounded
Contexts
Inside of the same Bounded Context, work can be planned on
separate Aggregates
Risk of conflicting changes is reduced
Weak coupling of Aggregates makes code flexible
Splitting a code base is easier
Risk of “shotgun sugery” when refactoring is reduced
Strong coupling inside of Aggregates makes code robust
Most important invariants are implemented in a highly controlled
environment
Strong coupling inside of an Aggregate makes detection of issues
in case of divergence in a sub-component faster
The size Aggregates is a trade-off. . .
The bigger, the more robust
The smaller, the more efficient
. . . but might also be driven by other requirements
Domain experts might not agree to subdivide some Aggregates
because it may not make sense
Reminder: an Entity inside of an Aggregate which is not the
Aggregate Root cannot be referenced from outside of the
Aggregate
→ if a reference is needed to an Entity, it must be an Aggregate
Root
Outline
The Framework
Knowledge
Efficiency
Maintainability
Conclusion
DDD is a powerful software design methodology
Allowing a deep understanding of the domain by both experts and
developers
Promoting efficiency while allowing to preseve robustness
Improving the maintainability of the code base
It is often considered as “hard”
Differences between design elements is sometimes subtel and
badly understood
Not concrete enough for developers
Too abstract for domain experts
In practice, a lot of technical details have to be solved
Keeping domain model clean
Transport of Domain Events in a distributed environment
Handling of failed Domain Event consumption
Handling of duplicate Domain Event consumptions
. . .
DDD is well suited to cases where it’s worth the price
Domain is huge and/or complex
Maintainability is critical
Efficiency is critical
Beware “à la carte” application of DDD
DDD is a global approach
→ most design rules are inter-dependent
Applying only parts of DDD might just get things harder but with
small benefits
If you still choose to do so, fine, but do not say you are doing DDD
Do you have questions?
Appendix: references
Eric Evans, Domain-Driven Design: Tackling Complexity in the
Heart of Software, 2003
Vaughn Vernon, Implementing Domain-Driven Design, 2013

Contenu connexe

Tendances

Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationOğuzhan Soykan
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignNader Albert
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven developmentDmitry Geyzersky
 
Domain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureDomain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureCrishantha Nanayakkara
 
Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011thinkddd
 
DDD Basics - Context mapping
DDD Basics - Context mappingDDD Basics - Context mapping
DDD Basics - Context mappingStijn Volders
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroFabrício Rissetto
 
Domain-Driven Design Basics
Domain-Driven Design BasicsDomain-Driven Design Basics
Domain-Driven Design BasicsMathias Verraes
 
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)IT Arena
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven DesignChristos Tsakostas
 
Domain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureDomain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureCan Pekdemir
 
Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Mark Windholtz
 
شرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربيشرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربيMohamed Galal
 
Domain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring PortfolioDomain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring PortfolioSrini Penchikala
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLCAbdul Karim
 
Domain Driven Design - Building Blocks
Domain Driven Design - Building BlocksDomain Driven Design - Building Blocks
Domain Driven Design - Building BlocksMark Windholtz
 

Tendances (20)

Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven development
 
Domain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureDomain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal Architecture
 
Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011
 
DDD Basics - Context mapping
DDD Basics - Context mappingDDD Basics - Context mapping
DDD Basics - Context mapping
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
Domain-Driven Design Basics
Domain-Driven Design BasicsDomain-Driven Design Basics
Domain-Driven Design Basics
 
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Domain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureDomain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal Architecture
 
Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
شرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربيشرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربي
 
Domain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring PortfolioDomain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring Portfolio
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLC
 
Domain Driven Design - Building Blocks
Domain Driven Design - Building BlocksDomain Driven Design - Building Blocks
Domain Driven Design - Building Blocks
 

Similaire à Domain-Driven Design

Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSSeminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSMizanur Sarker
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven DesignAndré Borgonovo
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignMuhammad Ali
 
RailswayCon 2010 - Command Your Domain
RailswayCon 2010 - Command Your DomainRailswayCon 2010 - Command Your Domain
RailswayCon 2010 - Command Your DomainLourens Naudé
 
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"GlobalLogic Ukraine
 
Making Inter-operability Visible
Making Inter-operability VisibleMaking Inter-operability Visible
Making Inter-operability Visibleliddy
 
Deconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignDeconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignVMware Tanzu
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .netMarco Parenzan
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-designArnaud Bouchez
 
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"Fwdays
 
From class to architecture
From class to architectureFrom class to architecture
From class to architectureMarcin Hawraniak
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignLalit Kale
 
Pragmatic Approach to Microservices and Cell-based Architecture
Pragmatic Approach to Microservices and Cell-based Architecture Pragmatic Approach to Microservices and Cell-based Architecture
Pragmatic Approach to Microservices and Cell-based Architecture Andrew Blades
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 

Similaire à Domain-Driven Design (20)

Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSSeminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
RailswayCon 2010 - Command Your Domain
RailswayCon 2010 - Command Your DomainRailswayCon 2010 - Command Your Domain
RailswayCon 2010 - Command Your Domain
 
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Making Inter-operability Visible
Making Inter-operability VisibleMaking Inter-operability Visible
Making Inter-operability Visible
 
DDD
DDDDDD
DDD
 
Deconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven DesignDeconstructing Monoliths with Domain Driven Design
Deconstructing Monoliths with Domain Driven Design
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .net
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
DDD eXchange
DDD eXchangeDDD eXchange
DDD eXchange
 
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
Serhiy Kalinets "Embracing architectural challenges in the modern .NET world"
 
From class to architecture
From class to architectureFrom class to architecture
From class to architecture
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Pragmatic Approach to Microservices and Cell-based Architecture
Pragmatic Approach to Microservices and Cell-based Architecture Pragmatic Approach to Microservices and Cell-based Architecture
Pragmatic Approach to Microservices and Cell-based Architecture
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Let's talk about... Microservices
Let's talk about... MicroservicesLet's talk about... Microservices
Let's talk about... Microservices
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 

Plus de Geeks Anonymes

Programmer sous Unreal Engine
Programmer sous Unreal EngineProgrammer sous Unreal Engine
Programmer sous Unreal EngineGeeks Anonymes
 
Implémentation efficace et durable de processus métiers complexes
Implémentation efficace et durable de processus métiers complexesImplémentation efficace et durable de processus métiers complexes
Implémentation efficace et durable de processus métiers complexesGeeks Anonymes
 
Managing Open Source Licenses (Geeks Anonymes)
Managing Open Source Licenses (Geeks Anonymes)Managing Open Source Licenses (Geeks Anonymes)
Managing Open Source Licenses (Geeks Anonymes)Geeks Anonymes
 
Reprendre le contrôle de ses données
Reprendre le contrôle de ses donnéesReprendre le contrôle de ses données
Reprendre le contrôle de ses donnéesGeeks Anonymes
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes
 
Le rôle du testeur et le Blackbox testing
Le rôle du testeur et le Blackbox testingLe rôle du testeur et le Blackbox testing
Le rôle du testeur et le Blackbox testingGeeks Anonymes
 
Vulnérabilités au cœur des applications Web, menaces et contre-mesures
 Vulnérabilités au cœur des applications Web, menaces et contre-mesures Vulnérabilités au cœur des applications Web, menaces et contre-mesures
Vulnérabilités au cœur des applications Web, menaces et contre-mesuresGeeks Anonymes
 
191121 philippe teuwen cryptographie et attaques materielles
191121 philippe teuwen cryptographie et attaques materielles191121 philippe teuwen cryptographie et attaques materielles
191121 philippe teuwen cryptographie et attaques materiellesGeeks Anonymes
 
"Surfez couverts !" - Conseils de Cyber securité
"Surfez couverts !" - Conseils de Cyber securité "Surfez couverts !" - Conseils de Cyber securité
"Surfez couverts !" - Conseils de Cyber securité Geeks Anonymes
 
Introduction au développement mobile - développer une application iOS et Andr...
Introduction au développement mobile - développer une application iOS et Andr...Introduction au développement mobile - développer une application iOS et Andr...
Introduction au développement mobile - développer une application iOS et Andr...Geeks Anonymes
 
Intelligence artificielle et propriété intellectuelle
Intelligence artificielle et propriété intellectuelleIntelligence artificielle et propriété intellectuelle
Intelligence artificielle et propriété intellectuelleGeeks Anonymes
 
Pour une histoire plophonique du jeu video
Pour une histoire plophonique du jeu videoPour une histoire plophonique du jeu video
Pour une histoire plophonique du jeu videoGeeks Anonymes
 
Become Rick and famous, thanks to Open Source
Become Rick and famous, thanks to Open SourceBecome Rick and famous, thanks to Open Source
Become Rick and famous, thanks to Open SourceGeeks Anonymes
 
Reconnaissance vocale et création artistique
Reconnaissance vocale et création artistiqueReconnaissance vocale et création artistique
Reconnaissance vocale et création artistiqueGeeks Anonymes
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingGeeks Anonymes
 
Sécurité, GDPR : vos données ont de la valeur
Sécurité, GDPR : vos données ont de la valeur Sécurité, GDPR : vos données ont de la valeur
Sécurité, GDPR : vos données ont de la valeur Geeks Anonymes
 

Plus de Geeks Anonymes (20)

Programmer sous Unreal Engine
Programmer sous Unreal EngineProgrammer sous Unreal Engine
Programmer sous Unreal Engine
 
Implémentation efficace et durable de processus métiers complexes
Implémentation efficace et durable de processus métiers complexesImplémentation efficace et durable de processus métiers complexes
Implémentation efficace et durable de processus métiers complexes
 
Managing Open Source Licenses (Geeks Anonymes)
Managing Open Source Licenses (Geeks Anonymes)Managing Open Source Licenses (Geeks Anonymes)
Managing Open Source Licenses (Geeks Anonymes)
 
Reprendre le contrôle de ses données
Reprendre le contrôle de ses donnéesReprendre le contrôle de ses données
Reprendre le contrôle de ses données
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
Le rôle du testeur et le Blackbox testing
Le rôle du testeur et le Blackbox testingLe rôle du testeur et le Blackbox testing
Le rôle du testeur et le Blackbox testing
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Vulnérabilités au cœur des applications Web, menaces et contre-mesures
 Vulnérabilités au cœur des applications Web, menaces et contre-mesures Vulnérabilités au cœur des applications Web, menaces et contre-mesures
Vulnérabilités au cœur des applications Web, menaces et contre-mesures
 
191121 philippe teuwen cryptographie et attaques materielles
191121 philippe teuwen cryptographie et attaques materielles191121 philippe teuwen cryptographie et attaques materielles
191121 philippe teuwen cryptographie et attaques materielles
 
"Surfez couverts !" - Conseils de Cyber securité
"Surfez couverts !" - Conseils de Cyber securité "Surfez couverts !" - Conseils de Cyber securité
"Surfez couverts !" - Conseils de Cyber securité
 
Introduction au développement mobile - développer une application iOS et Andr...
Introduction au développement mobile - développer une application iOS et Andr...Introduction au développement mobile - développer une application iOS et Andr...
Introduction au développement mobile - développer une application iOS et Andr...
 
Le langage rust
Le langage rustLe langage rust
Le langage rust
 
Test your code
Test your codeTest your code
Test your code
 
Intelligence artificielle et propriété intellectuelle
Intelligence artificielle et propriété intellectuelleIntelligence artificielle et propriété intellectuelle
Intelligence artificielle et propriété intellectuelle
 
Pour une histoire plophonique du jeu video
Pour une histoire plophonique du jeu videoPour une histoire plophonique du jeu video
Pour une histoire plophonique du jeu video
 
Become Rick and famous, thanks to Open Source
Become Rick and famous, thanks to Open SourceBecome Rick and famous, thanks to Open Source
Become Rick and famous, thanks to Open Source
 
Reconnaissance vocale et création artistique
Reconnaissance vocale et création artistiqueReconnaissance vocale et création artistique
Reconnaissance vocale et création artistique
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Sécurité, GDPR : vos données ont de la valeur
Sécurité, GDPR : vos données ont de la valeur Sécurité, GDPR : vos données ont de la valeur
Sécurité, GDPR : vos données ont de la valeur
 
Modern sql
Modern sqlModern sql
Modern sql
 

Dernier

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Dernier (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Domain-Driven Design

  • 1. Domain-Driven Design Focus on Knowledge, Efficiency and Maintainability Gérard Dethier1 1 Guardis / ComodIT http://www.comodit.com November 10th 2017 / Geeks Anonymes Liège
  • 2. Most IT systems consist in the implementation of a set of processes For instance, a company selling failure-prone products to coyotes: registration of a new client selling billing . . .
  • 3. Many implemented processes share the same structure Read some stuff from a database Modify parts of retrieved information while enforcing some rules Save the modified parts into the database
  • 4. While structure is simple, details can be complex When selling an Item to a Client, first check that there are enough Units available. If it’s the case, remove the Item from the Stock. If the number of Units in Stock goes below a given Threshold, the production of new Units should be triggered. Also, a Line should be added to the last Invoice not yet emitted. Finally, as soon as the Item is shipped, an e-mail should be sent to the Coyote. – An ACME domain expert
  • 5. Details may change in time Agile project management implies ever changing requirements The domain is evolving
  • 6. Domain experts and developers are not talking the same language Domain experts are talking about clients, units, stock, invoices, . . . Developers are talking about tables, records, objects, classes, relations, transactions. . . . . . and that’s perfectly fine (both languages are the most efficient when used in their context)!
  • 7. A common language is needed Understood by both domain experts and developers Precise Flexible Scalable in domain complexity
  • 8. The number of processes executed per time unit can be large For example, ACME faces: A growth in client base → many registrations many orders many invoices . . .
  • 9. Slow execution has a cost For example: Less registrations means less clients Slow invoicing has a bad impact on cash flow Slow client support might lead to clients leaving Note that the cost is not necessarily money
  • 10. Processes execution time must be low Implementation must be: Efficient Scalable
  • 11. Developers team evolves Developers might leave → potential loss of knowledge Team might grow to better respond to change → collaboration between developers becomes more complex (knowledge exchange, collisions in code changes. . . )
  • 12. Domain-Driven Design (DDD) is a framework addressing all those concerns Provides a meta-language for domain experts and developers easing the definition of a common language Includes the domain description in the code Defines design rules promoting flexible, efficient and scalable code, as well as improving collaboration between developers
  • 15. DDD defines a meta-language that can be used to develop a common language between domain experts and developers The meta-language looks like other well known “languages” (OOP, ER model) but is more abstract The Ubiquitous Language defines the vocabulary that domain experts and developers will use in their communication and in the code 10 design element types are available
  • 16. The Value Object (VO) has a state that does not evolve in time It has no identity and is only defined by its value It’s state is immutable It can have a behavior (it’s a good practice to put as much knowledge as possible in VOs) Examples: contact name, e-mail address, invoice number, . . .
  • 17. The Entity has a life cycle and an identity Its state may evolve over time It is uniquely identified by a key It’s state is, in general, made of a set of VOs It may reference other Entities
  • 18. The Aggregate defines a group of tightly coupled Entities One single Entity has the role of Aggregate Root it’s identity is the Aggregate’s identity it acts as an entry point to Aggregate’s behavior A set of invariants applies to the Entities part of the Aggregate No reference can point to any Entity of an Aggregate except the Aggregate Root
  • 19. Aggregates are built using Factories A Factory is stateless Built Aggregates have all their invariants fulfilled
  • 20. Aggregates are stored using Repositories A Repository is stateless Repositories expose a collection-like interface to perform CRUD operations Repositories hide the details of Aggregates’ storage
  • 21. A behavior not finding its place in any of previous elements is put in a Service A Service is stateless (Repositories and Factories are particular cases of Services) The choice of putting behavior in a Service rather than in a VO, Entity, Repository or Factory must be driven by the domain
  • 22. Modules allow to organize a domain when the number of elements grows The only purpose is organization No behavior No state
  • 23. When sub-domains are identified, they can be mapped to separate Bounded Contexts A Bounded Context defines a bounday in which a concept has a unique definition The same concept can appear in different Bounded Contexts but with varying definitions Bounded Contexts generally map to separate pieces of a system that model a given domain
  • 24. The Context Map shows the way Bounded Contexts are linked A link between 2 Bounded Contexts means they share related concepts Links can be annotated with the related concepts
  • 25. Only one Aggregate can be updated per transaction The Aggregate Root is acting as the “lock” At the end of the transaction, all invariants must be true
  • 26. Domain Events allow consistency rules spanning several Aggregates The update of one Aggregate triggers the publication of a Domain Event The Domain Event consumption implies the update of another Aggregate in another transaction After a sequence of transactions, all invariants are verified This is called Eventual Consistency
  • 27. Design elements can be categorized Stateful Behavioral Stuctural Value Object • • Entity • • Aggregate • Factory • Repository • Service • Module • Bounded Context • Context Map • Domain Event •
  • 29. Information is spread among elements with varying precision
  • 30. The structure of the model makes search efficient for everybody Tree search → O(logn) Domain experts and developers understand the model (they built it together!) The type of design elements tells if one might find a given type of information or not (state / behavior / structure)
  • 31. Deepening of the model does not get crippled by existing complexity . . . if information is evenly spread across leaves → VOs and Entities are the best places to store information It is then possible to focus on small pieces of the domain that need to be deepened
  • 33. Domain experts are generally open to delay the fulfillment of some constraints Acceptable delays may vary between a couple of seconds and days! Eventual Consistency can therefore be used in a lot of situations, in particular when fast response time is needed
  • 34. Small Aggregates are desirable Smaller (in terms of number of elements) Aggregates → shorter transactions Short transactions → improved scalability → reduced risk of conflict Perceived execution time for a process → short as only first step is blocking (following steps run in background)
  • 36. The model is documented by the code Discussions between domain experts and developers can be put in the context of actual code as both share a Ubiquitous Language No risk of stale external documentation obfuscating the model A domain expert is actually able to help a developer understand its own code!
  • 37. Clear separation of concerns allows parallel improvement of the model Several teams can work in parallel on separate Bounded Contexts Inside of the same Bounded Context, work can be planned on separate Aggregates Risk of conflicting changes is reduced
  • 38. Weak coupling of Aggregates makes code flexible Splitting a code base is easier Risk of “shotgun sugery” when refactoring is reduced
  • 39. Strong coupling inside of Aggregates makes code robust Most important invariants are implemented in a highly controlled environment Strong coupling inside of an Aggregate makes detection of issues in case of divergence in a sub-component faster
  • 40. The size Aggregates is a trade-off. . . The bigger, the more robust The smaller, the more efficient
  • 41. . . . but might also be driven by other requirements Domain experts might not agree to subdivide some Aggregates because it may not make sense Reminder: an Entity inside of an Aggregate which is not the Aggregate Root cannot be referenced from outside of the Aggregate → if a reference is needed to an Entity, it must be an Aggregate Root
  • 43. DDD is a powerful software design methodology Allowing a deep understanding of the domain by both experts and developers Promoting efficiency while allowing to preseve robustness Improving the maintainability of the code base
  • 44. It is often considered as “hard” Differences between design elements is sometimes subtel and badly understood Not concrete enough for developers Too abstract for domain experts In practice, a lot of technical details have to be solved Keeping domain model clean Transport of Domain Events in a distributed environment Handling of failed Domain Event consumption Handling of duplicate Domain Event consumptions . . .
  • 45. DDD is well suited to cases where it’s worth the price Domain is huge and/or complex Maintainability is critical Efficiency is critical
  • 46. Beware “à la carte” application of DDD DDD is a global approach → most design rules are inter-dependent Applying only parts of DDD might just get things harder but with small benefits If you still choose to do so, fine, but do not say you are doing DDD
  • 47. Do you have questions?
  • 48. Appendix: references Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software, 2003 Vaughn Vernon, Implementing Domain-Driven Design, 2013