2019-Nov: Domain Driven Design (DDD) and when not to use it

Mark Windholtz
Mark Windholtzsoftware Developer / Consultant um Agile DNA, LLC
Domain
Driven
Design
And when not to use it

Cincinnati SC 2019-11-06

mark@agiledna.com
https://github.com/mwindholtz/presentations/DDD-SC-Cinci
Wikimedia Commons
About me: mark@agiledna.com
• Built …
• eCommence site for ~12 years
• Memberships site for ~8 years
• Elixir: CC Processing, Medical Research, Energy Grid
• DDD Since 2006
• TDD since 1999 — sUnit
• Learned from Kent Beck, Bob Martin, Eric Evans
About YOU
• What Drives Your Product Code Design?
Some Observed Drivers …
• UI Screens / API
• Database Model
• Doing Risk Items First, or Last
• Architect’s Personal Issues - opposite of last project
• Features, Features, more Features
Domain Driven Design, 2003
• Tackling Complexity in the
Heart of S/W
• By Eric Evans
• “The Big Blue Book”
Domain-Driven Design (DDD)
• For …
• complex needs
• connects implementation to evolving model
• DOMAIN is the problem space
• MODEL is an abstracted potential solution
• Code is code
DDD: From Debt to Dividend
• Tech Debt
• Paying interest plus principle to temporarily move faster
• Tech Dividend
• Getting extra value on deep design to unlock extra
features
DDD is a Set of Principles
• Core Domain - focus here
• Explore Models in a Collaboration of
• Domain experts and the software team
• Separate Business from Technical
• Speak in a Ubiquitous Language
• within a Bounded Context
When to Apply Domain Design
• For Simple systems
• No worries. It fits inside a person’s head.
• For Medium systems
• No worries. Hire smart people so that ..
• It fits inside a person’s head. Oh and write loads of Documentation! **
• For Complex systems
• Starting is ok. It initially still fits inside a person’s head.
• Then Documents help a while
• But As It Grows …
** has an unknown expiration date.
** may also be wrong.
**Other restrictions may apply.
Warning !
• Simple Systems …
• Become Medium System …
• Which Become Complex systems
Why “Agile” Software becomes a Mess
• Feature story
• Design, design, design :-)
• Feature story, Feature story
• Design. :-|
• Feature story, Feature story, Feature story, Feature story,
Feature story :-(
• Feature story, Feature story, Feature story, Feature story,
Feature story :-o
Code Structure:
Big Ball Of Mud
Process Diagnosis:

Featureatitis
Design:
Preventing ripple effects
• Martin Fowler
Design Stamina Hypothesis
Software Craftsmanship — IS NOT ENOUGH —
• Refactoring
• Better names
• Test Driven Design
• Continuous Single Integration
• Something is still missing
Technical debt isn't
technical - Einar Høst -
DDD Europe 2019
DDD Prerequisites
• Close Collaboration of
Business
• Development in
Ubiquitous Language

• Iterative Development
DDD is Difficult to Explain. Why?
• Since the Problem is Complex and Subtle
• So is the Solution
• Difficult to scale down into examples
• Large Vocabulary of Interrelated Patterns
• Pattern Languages
Doing DDD - mark’s version
• Core Domain, and SubDomains

• Bounded Contexts

• Ubiquitous Language

• Building Blocks are Tactical Patterns

• Repeat … and Revisit
CORE DOMAIN
• A System Hard to understand is hard to change
• Boil down the MODEL
• Skilled developers are drawn to new tech
• Get top talent into the CORE DOMAIN
Application, as we Imagine it could be
Application, in Reality
Apply strategic patterns to find the Core Domain
DDD Topic Areas
• Strategic Patterns
• Tactical Patterns
• Communication Tips
Strategic Patterns
Finding & Separating 

The Core Domain
Wikimedia Commons
Bounded Context
• Large projects have multiple Models

• Combining Models causes bugs

• Model only has meaning in a context

• Therefore …
• Define the context of the Model

• Set boundaries in terms of 

• parts of the application

• team organization

• code bases, git-repositories
Acme
Internet of Things
Manager
ContextMap
• To develop a strategy, we need a
large-scale view across our project
and others we integrate with.

• Therefore …
• Describe the points of contact
between Models. 

• Explicit translations

• Sharing

• Isolation mechanisms

• Levels of influence
Acme
Internet of Things
Manager
Acme Smoke
Detector
Network
Arrow points
downstream
data flows
Data flows
to Manager
from Network
Smoke detector devices
DDD Topic Areas
• Strategic Patterns
• Tactical Patterns
• Communication Tips
Tactical Patterns
- Building Blocks
• Layered Architecture
• Aggregates
• Value Objects

• Entities

• Services

• Domain Events
Layered Architecture
Name Description Example
UI User Interface or API
Web form

Json API
Application
Thin. No Biz Rules. Stateless. 

Use Cases. Coordinator.

Funds Transfer
Service
Domain
Business Concepts, Biz Rules.

The heart of the business software.
DDD
Infrastructure Support for the other layers
Pub-Sub

DB
Aggregates in Layers - 1
Domain
Database
Application Service
UI
Gateway to External Services
API
Domain
Database
Application Service
UI
Gateway to External Services
API
A few other Building Blocks
Value Object
• Value only
{ :usd, 1000.00 }
{ :watt_hours, 900 }
Entity
• Life Cycle
• Has Identity field
%Order{ id: 2341334 }
%User{ id: 3421424 }
Aggregate
• Keep them Small
• Protect Business Invariants
inside Aggregate
• Reference Other Aggregates
by Identity only
• Update other Aggregates with
Eventual Consistency
•
Aggregates in Layers - 2
Domain
Database
Application Service
UI
Gateway to External Services
API
Domain
Database
Application Service
UI
Gateway to External Services
Aggregate AggregateAggregate Aggregate
API
Aggregates in Layers - 3
Domain
Database
Application Service
UI
Gateway to External Services
API
Domain
Database
Application Service
UI
Gateway to External Services
Aggregate
API
Root
Aggregates in Layers - 4
Domain
Database
Application Service
UI
Gateway to External Services
Event Bus
API
DDD Topic Areas
• Strategic Patterns
• Tactical Patterns
• Communication Tips
Communication Tips
• Investigate, question Constraints
• Listening for missing Words and Concepts
• Ask “Why?”
• Event Storming
• Whirlpool
Event Storming
Event Storming
MODEL Exploration
When to use Full-DDD
• Strategic, Tactical, Communication
• Increasing complexity is slowing down progress
• Defects about fundamental Model are increasing
• Edge Cases are increasing
When to use Partial-DDD - Strategic
• As an Architect
• Use Bounded Context to reduce confusion
• Context Mapping to see flow of the MODEL
• When: more then two main modules
When to use Partial-DDD - Tactical
• As a Developer: Use Building Blocks
• Layered Architecture, Aggregate
• TDD
• When: Increasing conditional statements
• When: DB accessed everywhere, big test setup
• When: DB Locking issues
When not to use DDD
• Simple CRUD / REST application needs
• Not using an iterative process
• Poor access to Domain Experts
• Build and forget apps
CRUD => Active Record => Domain Model => DDD
- Davin Tryon, via stack overflow
Just the beginning …
Acme
Internet of Things
Manager
Acme Smoke
Detector
Network
1 von 45

Recomendados

Domain Driven Design - Distillation - Chapter 15 von
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Mark Windholtz
152 views31 Folien
Domain Driven Design Big Picture Strategic Patterns von
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsMark Windholtz
125 views34 Folien
Domain Driven Design Communication Techniques von
Domain Driven Design Communication TechniquesDomain Driven Design Communication Techniques
Domain Driven Design Communication TechniquesMark Windholtz
123 views27 Folien
Domain Driven Design - Building Blocks von
Domain Driven Design - Building BlocksDomain Driven Design - Building Blocks
Domain Driven Design - Building BlocksMark Windholtz
123 views25 Folien
Domain-Driven Design von
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignGeeks Anonymes
732 views48 Folien
Amazon AWS - a quick review von
Amazon AWS - a quick reviewAmazon AWS - a quick review
Amazon AWS - a quick reviewGeeks Anonymes
247 views33 Folien

Más contenido relacionado

Was ist angesagt?

Android application development von
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
424 views33 Folien
Unlock the Power of Streaming Data with Kinetica and Confluent Platform von
Unlock the Power of Streaming Data with Kinetica and Confluent PlatformUnlock the Power of Streaming Data with Kinetica and Confluent Platform
Unlock the Power of Streaming Data with Kinetica and Confluent Platformconfluent
212 views41 Folien
Monolith to Microservices - O’Reilly Oscon von
Monolith to Microservices - O’Reilly OsconMonolith to Microservices - O’Reilly Oscon
Monolith to Microservices - O’Reilly OsconChristopher Grant
658 views58 Folien
Why we got to Docker von
Why we got to DockerWhy we got to Docker
Why we got to Dockerallingeek
144 views17 Folien
Overview of DITA 1.3 von
Overview of DITA 1.3Overview of DITA 1.3
Overview of DITA 1.3IXIASOFT
1.4K views34 Folien
Schibsted Spain - Day 1 - DDD Course von
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseKevin Mas Ruiz
177 views66 Folien

Was ist angesagt?(14)

Unlock the Power of Streaming Data with Kinetica and Confluent Platform von confluent
Unlock the Power of Streaming Data with Kinetica and Confluent PlatformUnlock the Power of Streaming Data with Kinetica and Confluent Platform
Unlock the Power of Streaming Data with Kinetica and Confluent Platform
confluent212 views
Monolith to Microservices - O’Reilly Oscon von Christopher Grant
Monolith to Microservices - O’Reilly OsconMonolith to Microservices - O’Reilly Oscon
Monolith to Microservices - O’Reilly Oscon
Christopher Grant658 views
Why we got to Docker von allingeek
Why we got to DockerWhy we got to Docker
Why we got to Docker
allingeek144 views
Overview of DITA 1.3 von IXIASOFT
Overview of DITA 1.3Overview of DITA 1.3
Overview of DITA 1.3
IXIASOFT1.4K views
Schibsted Spain - Day 1 - DDD Course von Kevin Mas Ruiz
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
Kevin Mas Ruiz177 views
Java Community Webinar #8: “High Performance Systems Design” von GlobalLogic Ukraine
Java Community Webinar #8: “High Performance Systems Design”Java Community Webinar #8: “High Performance Systems Design”
Java Community Webinar #8: “High Performance Systems Design”
DDD Taiwan Community 2019 01-26-1st-meetup-why ddd matters von Kim Kao
DDD Taiwan Community 2019 01-26-1st-meetup-why ddd mattersDDD Taiwan Community 2019 01-26-1st-meetup-why ddd matters
DDD Taiwan Community 2019 01-26-1st-meetup-why ddd matters
Kim Kao1.2K views
The five expertise of a software architect von Lior Bar-On
The five expertise of a software architectThe five expertise of a software architect
The five expertise of a software architect
Lior Bar-On6.6K views
Building Blocks for Hybrid IT von RightScale
Building Blocks for Hybrid ITBuilding Blocks for Hybrid IT
Building Blocks for Hybrid IT
RightScale937 views
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps von Eason Kuo
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Eason Kuo2.7K views
Best Practice In Software Development von SARCCOM
Best Practice In Software DevelopmentBest Practice In Software Development
Best Practice In Software Development
SARCCOM392 views
DITA Quick Start Webinar: Defining Your Style Sheet Requirements von Suite Solutions
DITA Quick Start Webinar: Defining Your Style Sheet RequirementsDITA Quick Start Webinar: Defining Your Style Sheet Requirements
DITA Quick Start Webinar: Defining Your Style Sheet Requirements
Suite Solutions2.9K views
DCSF 19 Modern Orchestrated IT for Enterprise CMS von Docker, Inc.
DCSF 19  Modern Orchestrated IT for Enterprise CMSDCSF 19  Modern Orchestrated IT for Enterprise CMS
DCSF 19 Modern Orchestrated IT for Enterprise CMS
Docker, Inc.209 views

Similar a 2019-Nov: Domain Driven Design (DDD) and when not to use it

Software Architecture and Architectors: useless VS valuable von
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableComsysto Reply GmbH
93 views79 Folien
Pros & Cons of Microservices Architecture von
Pros & Cons of Microservices ArchitecturePros & Cons of Microservices Architecture
Pros & Cons of Microservices ArchitectureAshwini Kuntamukkala
2.8K views31 Folien
Designing and Implementing Information Systems with Event Modeling, Bobby Cal... von
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...confluent
194 views41 Folien
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ... von
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...confluent
2.8K views41 Folien
SPSNYC2019 - What is Common Data Model and how to use it? von
SPSNYC2019 - What is Common Data Model and how to use it?SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?Nicolas Georgeault
778 views61 Folien
Forge - DevCon 2016: Implementing Rich Applications in the Browser von
Forge - DevCon 2016: Implementing Rich Applications in the BrowserForge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the BrowserAutodesk
577 views51 Folien

Similar a 2019-Nov: Domain Driven Design (DDD) and when not to use it(20)

Software Architecture and Architectors: useless VS valuable von Comsysto Reply GmbH
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuable
Designing and Implementing Information Systems with Event Modeling, Bobby Cal... von confluent
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent194 views
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ... von confluent
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent2.8K views
SPSNYC2019 - What is Common Data Model and how to use it? von Nicolas Georgeault
SPSNYC2019 - What is Common Data Model and how to use it?SPSNYC2019 - What is Common Data Model and how to use it?
SPSNYC2019 - What is Common Data Model and how to use it?
Nicolas Georgeault778 views
Forge - DevCon 2016: Implementing Rich Applications in the Browser von Autodesk
Forge - DevCon 2016: Implementing Rich Applications in the BrowserForge - DevCon 2016: Implementing Rich Applications in the Browser
Forge - DevCon 2016: Implementing Rich Applications in the Browser
Autodesk 577 views
It is a sunny day von bcoder
It is a sunny dayIt is a sunny day
It is a sunny day
bcoder272 views
Friday final test von bcoder
Friday final testFriday final test
Friday final test
bcoder474 views
My Path From Data Engineer to Analytics Engineer von GoDataDriven
My Path From Data Engineer to Analytics EngineerMy Path From Data Engineer to Analytics Engineer
My Path From Data Engineer to Analytics Engineer
GoDataDriven146 views
Agile Development – Why requirements matter by Fariz Saracevic von Agile ME
Agile Development – Why requirements matter by Fariz SaracevicAgile Development – Why requirements matter by Fariz Saracevic
Agile Development – Why requirements matter by Fariz Saracevic
Agile ME193 views
Model-driven and low-code development for event-based systems | Bobby Calderw... von HostedbyConfluent
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent1.2K views
Managing Enterprise Data Science 201904 von Mark Tabladillo
Managing Enterprise Data Science 201904Managing Enterprise Data Science 201904
Managing Enterprise Data Science 201904
Mark Tabladillo92 views
Data-Ed: Data Architecture Requirements von Data Blueprint
Data-Ed: Data Architecture Requirements Data-Ed: Data Architecture Requirements
Data-Ed: Data Architecture Requirements
Data Blueprint1.9K views
Data-Ed Online: Data Architecture Requirements von DATAVERSITY
Data-Ed Online: Data Architecture RequirementsData-Ed Online: Data Architecture Requirements
Data-Ed Online: Data Architecture Requirements
DATAVERSITY3K views
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632) von TIMETOACT GROUP
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
Integrate Applications into IBM Connections Cloud and On Premises (AD 1632)
TIMETOACT GROUP1.8K views

Más de Mark Windholtz

XP-Retro from Codemash.org Jan 2018 von
XP-Retro from Codemash.org Jan 2018XP-Retro from Codemash.org Jan 2018
XP-Retro from Codemash.org Jan 2018Mark Windholtz
114 views56 Folien
War between Tools and Design 2016 von
War between Tools and Design 2016War between Tools and Design 2016
War between Tools and Design 2016Mark Windholtz
167 views53 Folien
2020-Feb: Testing: Cables and Chains von
2020-Feb: Testing: Cables and Chains2020-Feb: Testing: Cables and Chains
2020-Feb: Testing: Cables and ChainsMark Windholtz
94 views34 Folien
Planning XP - Extreme Programming von
Planning XP - Extreme ProgrammingPlanning XP - Extreme Programming
Planning XP - Extreme ProgrammingMark Windholtz
159 views22 Folien
2017 June AgileCincy Event Storming von
2017 June AgileCincy Event Storming2017 June AgileCincy Event Storming
2017 June AgileCincy Event StormingMark Windholtz
366 views25 Folien
Planning XP von
Planning XPPlanning XP
Planning XPMark Windholtz
83 views22 Folien

Más de Mark Windholtz(6)

Último

Introduction to Maven von
Introduction to MavenIntroduction to Maven
Introduction to MavenJohn Valentino
6 views10 Folien
JioEngage_Presentation.pptx von
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptxadmin125455
6 views4 Folien
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx von
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptxanimuscrm
15 views19 Folien
predicting-m3-devopsconMunich-2023.pptx von
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptxTier1 app
7 views24 Folien
SAP FOR TYRE INDUSTRY.pdf von
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdfVirendra Rai, PMP
28 views3 Folien
Flask-Python.pptx von
Flask-Python.pptxFlask-Python.pptx
Flask-Python.pptxTriloki Gupta
7 views12 Folien

Último(20)

JioEngage_Presentation.pptx von admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254556 views
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx von animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm15 views
predicting-m3-devopsconMunich-2023.pptx von Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app7 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... von NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi215 views
Bootstrapping vs Venture Capital.pptx von Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic14 views
Dapr Unleashed: Accelerating Microservice Development von Miroslav Janeski
Dapr Unleashed: Accelerating Microservice DevelopmentDapr Unleashed: Accelerating Microservice Development
Dapr Unleashed: Accelerating Microservice Development
Miroslav Janeski12 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... von sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik8 views
Understanding HTML terminology von artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar56 views
Airline Booking Software von SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta7 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action von Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok15 views
Copilot Prompting Toolkit_All Resources.pdf von Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana16 views
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation von HCLSoftware
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
HCLSoftware6 views
Navigating container technology for enhanced security by Niklas Saari von Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 views

2019-Nov: Domain Driven Design (DDD) and when not to use it

  • 1. Domain Driven Design And when not to use it Cincinnati SC 2019-11-06 mark@agiledna.com https://github.com/mwindholtz/presentations/DDD-SC-Cinci Wikimedia Commons
  • 2. About me: mark@agiledna.com • Built … • eCommence site for ~12 years • Memberships site for ~8 years • Elixir: CC Processing, Medical Research, Energy Grid • DDD Since 2006 • TDD since 1999 — sUnit • Learned from Kent Beck, Bob Martin, Eric Evans
  • 3. About YOU • What Drives Your Product Code Design?
  • 4. Some Observed Drivers … • UI Screens / API • Database Model • Doing Risk Items First, or Last • Architect’s Personal Issues - opposite of last project • Features, Features, more Features
  • 5. Domain Driven Design, 2003 • Tackling Complexity in the Heart of S/W • By Eric Evans • “The Big Blue Book”
  • 6. Domain-Driven Design (DDD) • For … • complex needs • connects implementation to evolving model • DOMAIN is the problem space • MODEL is an abstracted potential solution • Code is code
  • 7. DDD: From Debt to Dividend • Tech Debt • Paying interest plus principle to temporarily move faster • Tech Dividend • Getting extra value on deep design to unlock extra features
  • 8. DDD is a Set of Principles • Core Domain - focus here • Explore Models in a Collaboration of • Domain experts and the software team • Separate Business from Technical • Speak in a Ubiquitous Language • within a Bounded Context
  • 9. When to Apply Domain Design • For Simple systems • No worries. It fits inside a person’s head. • For Medium systems • No worries. Hire smart people so that .. • It fits inside a person’s head. Oh and write loads of Documentation! ** • For Complex systems • Starting is ok. It initially still fits inside a person’s head. • Then Documents help a while • But As It Grows … ** has an unknown expiration date. ** may also be wrong. **Other restrictions may apply.
  • 10. Warning ! • Simple Systems … • Become Medium System … • Which Become Complex systems
  • 11. Why “Agile” Software becomes a Mess • Feature story • Design, design, design :-) • Feature story, Feature story • Design. :-| • Feature story, Feature story, Feature story, Feature story, Feature story :-( • Feature story, Feature story, Feature story, Feature story, Feature story :-o
  • 12. Code Structure: Big Ball Of Mud Process Diagnosis: Featureatitis Design: Preventing ripple effects
  • 13. • Martin Fowler Design Stamina Hypothesis
  • 14. Software Craftsmanship — IS NOT ENOUGH — • Refactoring • Better names • Test Driven Design • Continuous Single Integration • Something is still missing
  • 15. Technical debt isn't technical - Einar Høst - DDD Europe 2019
  • 16. DDD Prerequisites • Close Collaboration of Business • Development in Ubiquitous Language • Iterative Development
  • 17. DDD is Difficult to Explain. Why? • Since the Problem is Complex and Subtle • So is the Solution • Difficult to scale down into examples • Large Vocabulary of Interrelated Patterns • Pattern Languages
  • 18. Doing DDD - mark’s version • Core Domain, and SubDomains • Bounded Contexts • Ubiquitous Language • Building Blocks are Tactical Patterns • Repeat … and Revisit
  • 19. CORE DOMAIN • A System Hard to understand is hard to change • Boil down the MODEL • Skilled developers are drawn to new tech • Get top talent into the CORE DOMAIN
  • 20. Application, as we Imagine it could be
  • 22. Apply strategic patterns to find the Core Domain
  • 23. DDD Topic Areas • Strategic Patterns • Tactical Patterns • Communication Tips
  • 24. Strategic Patterns Finding & Separating The Core Domain Wikimedia Commons
  • 25. Bounded Context • Large projects have multiple Models • Combining Models causes bugs • Model only has meaning in a context • Therefore … • Define the context of the Model • Set boundaries in terms of • parts of the application • team organization • code bases, git-repositories Acme Internet of Things Manager
  • 26. ContextMap • To develop a strategy, we need a large-scale view across our project and others we integrate with. • Therefore … • Describe the points of contact between Models. • Explicit translations • Sharing • Isolation mechanisms • Levels of influence Acme Internet of Things Manager Acme Smoke Detector Network Arrow points downstream data flows Data flows to Manager from Network Smoke detector devices
  • 27. DDD Topic Areas • Strategic Patterns • Tactical Patterns • Communication Tips
  • 28. Tactical Patterns - Building Blocks • Layered Architecture • Aggregates • Value Objects • Entities • Services • Domain Events
  • 29. Layered Architecture Name Description Example UI User Interface or API Web form Json API Application Thin. No Biz Rules. Stateless. Use Cases. Coordinator. Funds Transfer Service Domain Business Concepts, Biz Rules. The heart of the business software. DDD Infrastructure Support for the other layers Pub-Sub DB
  • 30. Aggregates in Layers - 1 Domain Database Application Service UI Gateway to External Services API Domain Database Application Service UI Gateway to External Services API
  • 31. A few other Building Blocks Value Object • Value only { :usd, 1000.00 } { :watt_hours, 900 } Entity • Life Cycle • Has Identity field %Order{ id: 2341334 } %User{ id: 3421424 }
  • 32. Aggregate • Keep them Small • Protect Business Invariants inside Aggregate • Reference Other Aggregates by Identity only • Update other Aggregates with Eventual Consistency •
  • 33. Aggregates in Layers - 2 Domain Database Application Service UI Gateway to External Services API Domain Database Application Service UI Gateway to External Services Aggregate AggregateAggregate Aggregate API
  • 34. Aggregates in Layers - 3 Domain Database Application Service UI Gateway to External Services API Domain Database Application Service UI Gateway to External Services Aggregate API Root
  • 35. Aggregates in Layers - 4 Domain Database Application Service UI Gateway to External Services Event Bus API
  • 36. DDD Topic Areas • Strategic Patterns • Tactical Patterns • Communication Tips
  • 37. Communication Tips • Investigate, question Constraints • Listening for missing Words and Concepts • Ask “Why?” • Event Storming • Whirlpool
  • 41. When to use Full-DDD • Strategic, Tactical, Communication • Increasing complexity is slowing down progress • Defects about fundamental Model are increasing • Edge Cases are increasing
  • 42. When to use Partial-DDD - Strategic • As an Architect • Use Bounded Context to reduce confusion • Context Mapping to see flow of the MODEL • When: more then two main modules
  • 43. When to use Partial-DDD - Tactical • As a Developer: Use Building Blocks • Layered Architecture, Aggregate • TDD • When: Increasing conditional statements • When: DB accessed everywhere, big test setup • When: DB Locking issues
  • 44. When not to use DDD • Simple CRUD / REST application needs • Not using an iterative process • Poor access to Domain Experts • Build and forget apps CRUD => Active Record => Domain Model => DDD - Davin Tryon, via stack overflow
  • 45. Just the beginning … Acme Internet of Things Manager Acme Smoke Detector Network