Implementing Domain Driven Design
Implementing Domain Driven Design
Driven Design
VAUGHN VERNON
Domain-Driven
Design Distilled,
Vaughn Vernon,
2016
•DDD is a set of tools that assist you in designing and
implementing software that delivers high value, both
strategically and tactically.
•The DDD strategic development tools help you and your
Chapter 1. DDD team make the competitively best software design choices
and integration decisions for your business.
for Me •The DDD tactical development tools can help you and your
team design useful software that accurately models the
business’s unique operations.
•Often people talk about good design and bad design.
•What kind of design do you do?
◦ In many cases: “the task-board shuffle.” - move a sticky note
from the “To Do” column to the “In Progress” column.
◦ This often happens due to the pressure to deliver software
releases on a relentless schedule
Good, Bad, and •Effective design meets the needs of the business
organization to the extent that it can distinguish itself from
Effective Design its competition by means of software.
• You really cannot apply tactical design in an effective way
Strategic Design unless you begin with strategic design.
• It highlights what is strategically important to your business,
how to divide up the work by importance, and how to best
integrate as needed.
• Developers + Domain Experts = DDD team.
• Bounded Contexts – segregation of domain models using
the strategic design pattern.
• Ubiquitous Language - the language developed by DDD
team together through collaboration.
• Subdomains – deal with the unbounded complexity of
legacy systems
Context Mapping – both team relationships and technical
mechanisms that exist between two integrating Bounded
Contexts
Tactical Design ▪Tactical design is like using a thin brush to paint the fine
details of your domain model.
▪ Aggregate - one of the more important tools is used to
aggregate entities and value objects together into a right-
sized cluster.
▪ Domain Events - something that happened in the domain
that you want other parts of the local (or remote) Bounded
Context to be aware of.
Strategic Design with
Bounded Contexts and the
Ubiquitous Language
CHAPTER 2
Bounded context
• Bounded Context is a semantic contextual boundary.
• Within the boundary each component of the software model has a specific meaning and does
specific things.
• The components inside a Bounded Context are context specific and semantically motivated.
• Bounded Context is where a model is implemented, and you will have separate software
artifacts for each Bounded Context.
Ubiquitous Language
• The software model inside the context boundary reflects a language that is developed by the
team working in the Bounded Context.
• It is spoken by every member of the team that creates the software model that functions within
that Bounded Context.
• The language is called the Ubiquitous Language because it is both spoken among the team
members and implemented in the software model.
• Ubiquitous Language must be rigorous—strict, exact, stringent, and tight.
• When someone on the team uses expressions from the Ubiquitous Language , everyone on the
team understands what is meant with precision and constraints.
• Active participation from the domain experts is absolutely essential for domain driven design to
succeed.
Ubiquitous Language
• You can document the ubiquitous language in various ways.
• glossary of terms
• Business processes can be described graphically using e.g. swimlane diagrams and flow charts.
• UML - the relationship between things
• State diagrams - how state changes as different things move through different processes
• Maybe different "dialects" of the language for different subdomains.
• The domain model is not the same as a data model or a UML class diagram.
Creating the Ubiquitous
Language
THERE SHOULD BE ONE
TEAM ASSIGNED TO WORK
SEPARATE SOURCE CODE
REPOSITORY FOR EACH
ONE TEAM CAN WORK ON
MULTIPLE BOUNDED
Bounded
Contexts,
ON ONE BOUNDED BOUNDED CONTEXT. CONTEXTS.
CONTEXT. MULTIPLE TEAMS SHOULD
NOT WORK ON A SINGLE
BOUNDED CONTEXT.
Teams, and
Source Code
CLEANLY SEPARATE THE KEEP ACCEPTANCE TESTS YOUR TEAM OWNS THE
Repositories
SOURCE CODE AND AND UNIT TESTS SOURCE CODE AND THE
DATABASE SCHEMA FOR TOGETHER WITH THE MAIN DATABASE AND DEFINES
EACH BOUNDED CONTEXT SOURCE CODE. THE OFFICIAL INTERFACES
IN THE SAME WAY THAT THROUGH WHICH YOUR
YOU SEPARATE THE BOUNDED CONTEXT MUST
UBIQUITOUS LANGUAGE. BE USED.
Big Ball of Mud
This is where a system has multiple tangled models without explicit boundaries. It probably also
requires multiple teams to work on it, which is very problematic. Furthermore, various
unrelated concepts are blown out over many modules and interconnected with conflicting
elements. If this project has tests, it probably takes a very long time to run them, and so the
tests may be bypassed at especially important times.
Case Study
SCRUM-BASED AGILE PROJECT MANAGEMENT APPLICATION
Scrum-based agile project management application
Iteration 1
• central or core concept is Product
Scrum-based agile project management application
Iteration 2
Scrum-based agile project management application
Iteration 3
Scrum-based agile project management application
Iteration 4
Scrum-based agile project management application
Iteration 4 Fundamental Strategic Design Needed!!
What tools are available with DDD to
help us avoid such pitfalls?
• Bounded Context
• The Bounded Context should hold closely all concepts that are
core to the strategic initiative and push out all others.
Collaboration
Agile Project Context is the
Management Context is source of the
the consumer of the Discussion
Discussion