Domain Driven Design
more than code
Who am I?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/5426980/19029742_10212118839960433_3809399219961601328_n.jpg)
Damiano Petrungaro
Italy
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6150916/italy.jpg)
source: www.vidiani.com
Tivoli (RM)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6150921/tivoli.jpg)
source: www.livitaly.com
Tivoli (RM)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6154240/buche-villanova-3.jpg)
source: www.romaest.org
Tivoli (RM)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6154243/arco.jpg)
source: www.tivolitouring.com
Tivoli (RM)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6154245/traffico.jpg)
source: www.confinelive.it
Tivoli (RM)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6154257/greenpark.jpg)
source: www.greenparkmadama.it
Me everyday:
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/6222124/me-chicken.jpeg)
What is DDD ?
Domain Driven Design is an approach to software development for complex needs by connecting the implementation to an evolving model.
It is not about code.
![](https://media2.giphy.com/media/P97b37JwsJUcw/giphy.gif)
It is not, only, about code.
Strategic Design
Tactical Design
The strategic design is the one in which you and the domain experts analyze a domain, define its boundaries, and look for the best way to let communicate different boundaries.
The tactical design describes a group of patterns to use to shape as code the invariants and models defined in a domain analysis that is often (hopefully) driven by the strategic design.
Give a set of tools that you can use to solve common organizational problems.
Goal of this talk:
There will be no code.
At all.
![](https://media3.giphy.com/media/VStxBrCyssRPO/giphy.gif)
Everything starts with an idea
Let's build a new product!
![](https://media2.giphy.com/media/WOCOc6EJYMrdq6ck9x/giphy.gif)
![](https://media0.giphy.com/media/l4FGuhL4U2WyjdkaY/giphy.gif)
Let's code it!
Understand the problem
Contexts
The circumstances that form the setting for an event, statement, or idea, and in terms of which it can be fully understood.
" The first result of a Google search
![](https://media2.giphy.com/media/13yRvVBLecZGBa/giphy.gif)
Why context matters?
![](https://media2.giphy.com/media/13JHOHY8NoO8Bq/giphy.gif)
Office
Shower
Be naked in:
![](https://media1.giphy.com/media/orUAhRCsxKuY0dDytt/giphy.gif)
![](https://media3.giphy.com/media/fecNG75D05c6HZF0JA/giphy.gif)
![](https://media2.giphy.com/media/PP3qEnfVBXifKqyGVm/giphy.gif)
Nude Beach
Non-Nude Beach
Context may looks similar but...
Be naked in:
How does it relate to DDD?
Context influences behaviors, the language and the meaning of the words
Polysemy
![](https://media1.giphy.com/media/107KlThVAe0M0w/giphy.gif)
![](https://media1.giphy.com/media/S4CTButEaN4vm/giphy.gif)
Star
The
ubiquitous language
- Clear communication
- Teams
- Customers & CC
- Onboarding
- Code express behavior
Bounded Context
![](https://media2.giphy.com/media/McWbEQHVnFEiY/giphy.gif)
It is part of the Strategic Pattern of the DDD literature and it represents a logical boundary where the rules of a sub-domain are applied and make your context unique
![](https://media0.giphy.com/media/3WmWdBzqveXaE/giphy.gif)
Split the problem
Sub-Domains
Core: is a part of the business that is of primary importance to the success of the organization.
Supporting: is a part of the business that is essential, but yet not Core.
Generic: is a part of the business that looks like a supporting subdomains but it is not specialized.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/760725/images/5850398/domain.jpg)
A domain visualization
Context map
Bounded contexts are isolated.
But they need to communicate.
9 ways to communicate across contexts
- Partnership
- Shared Kernel
- Customer-Supplier Development
- Conformist
- Anticorruption layer
- Open Host Service
- Published Language
- Separate ways
- Big ball of mud
Clear dependencies
Clear relationship
Clear contracts
Recap
- Study the problem before solving it
- Identify sub-domains and scope their contexts
- Define a common language to use in each sub-domain
- Find a way to communicate with the other sub-domains defining contracts, if needed
That's it folks!
![](https://media0.giphy.com/media/1luZiRMYHgQseDm4LP/giphy.gif)
fun fact: "/giphy damiano"
Domain Driven Design
By Damiano Petrungaro
Domain Driven Design
- 1,069