SlideShare uma empresa Scribd logo
1 de 53
● Chcesz pracować w LAB?
Pisz śmiało!
● Chcesz zrobić swoje zadanie
rozwojowe we współpracy z
LAB?
Pisz śmiało!
● Masz propozycję tematu, który
mógłby zostać rozpoznany
przez LAB?
Pisz śmiało!
Wojtek Suwała, ASC LAB Head Architect
Domain Driven Design
Introduction for the Software House
Software development is
easy,
isn’t it?
We must be doing something wrong ...
We are developing software since 1960’s, yet:
• From 2011 to 2015 the percentage of successful IT
projects remains unchanged on a level of just 22%
• Over 19% of all projects failed
• The rest have experienced challenges
https://www.projectsmart.co.uk/white-papers/chaos-report.pdf
Complexity
Good complexity :)
Domain logic complexity inherent to the domain itself.
Bad complexity :(
Accidental complexity from:
• mixing problem space with solution space
• lack of understanding of business domain
• mixing technical solution complexities
Mixing domain complexity with technical
complexity
Enterprise Software
Development
Best Practices
Developers
Business
Domain-Driven Design is a language and
domain-centric approach to software
design for complex problem domains.
The term was coined by Eric Evans in his
Complexity from the
domain is inherent
seminal book “Domain-Driven Design:
Tackling Complexity in the Heart of
Software”. It consists of a collection of
patterns, principles and practices that will
enable teams to focus on what is core to
the success of the business while crafting
software that manages complexity in both
the technical and business spaces.
How about doing it right
What do you mean when you say Software
Development?
Software development is a collaborative
learning process involving developers
and business experts.
Problem Space
• Understanding customer’s business domain
• Building shared language
• What is our customer’s core business?
• What are customer’s goals?
• What problems we are trying to solve?
• Where our customer can gain / lose money?
Big Picture Event Storming
Domain Storytelling
Big Picture Exploration Outcomes:
• Better understanding of business domain
• Initial business concepts definitions
• Hot spots and opportunities revealed
• Big Domain initially divided into smaller parts - subdomains
Not All Parts Of The Problem Are Equal
Subdomains
Subdomain types
Core domain - the core thing identifies customer’s business
and distinguished them from competitors. This is where we
should focus on and where we can send our best troops.
Supporting domains - things that must be done in order to
support core business but are not unique. No need to spend
lot of time modelling it. Probably existing patterns can be
used. Less skilled teams can be assigned.
Generic domains - things most enterprises do in the same
way. Can be bought/outsourced.
Supporting / generic subdomains
Subdomains - Finding Core
Agile Estimation can be used to identify Core and where we
should apply DDD tactical patterns versus CRUD.
On the other side, there is the Complexity/Cost that is
associated with implementing software to manage the
Bounded Context.
Subdomains with Large Competitive Advantage and Large
Complexity/Cost are the ones we should focus our effort on.
Alternatively use Impact Mapping.
Solution Space
Defining right solution to the right problem with a little help
of …
• Bounded Contexts
• Models
• Ubiquitous Language
• Context Maps
Corporate Model Anti-Pattern
Developers and Analysts are often trying to create one big
model that has all data and handles all the use cases.
We try to “sum up” many people different views on given
term.
This approach leads to having brittle, complex models full of
unnecessary abstractions. It brings lots of accidental
complexity to our solution.
Such model is hard to extend and maintain over time.
It is makes dividing work and responsibility to teams very
hard.
Don’t put everything into one model
Policy
Create Offer, Buy Policy
Annex, Terminate
Register Case
Approve Case Payment
Register Payment
Change Payment Schedule
Create Renewal Offer, Renew
Calculate Reserves
Calculate Commission
Renewals
Claims
handling
Payments
Accounting
&
Reporting
Sales
Policy
Management
Don’t put everything into one model
pictures from https://refactoring.guru/smells/large-class
Bounded Context & Ubiquitous Language
Bounded contexts divide solution space into smaller parts where we
work on smaller models.
Bounded context defines applicability of the model. It gives clarity on
what is model used for, where is should be consistent and what it
should ignore.
Bounded context protects model inside it from things outside of it.
Model should only change to better support functionality it is designed
for, not due to requirements external to it.
Bounded context gives team assigned to it autonomy and protection.
Bounded Context & Ubiquitous Language
Given domain term has precise meaning in given context.
Project language shared between devs and customer and
reflected in code must be precise in given bounded context.
Bounded Context & Ubiquitous Language
Example: E-Commerce System
Product in context of Sales is described by price, available models,
technical specification.
It exposes two capabilities: can be sold and can be found by various
criteria.
Product in context of Shipping is described in terms of weight,
package size, package handling rules, warehouse location and
stock.
It exposes capabilities: can be found, can be shipped, new stock can
be placed and located.
Bounded Context & Ubiquitous Language
Bounded contexts should be created around business
capability, not around data.
Bounded contexts tend to align with customer organization’s
structure - Conway’s Law
What is domain model?
Domain model is central part of Domain Driven Design. We
focus on creation and further enhancements of domain
models.
It’s first version comes as analytical model from
collaboration of devs and business experts during design
and knowledge crunching sessions.
It represents view of the domain needed to support
business use case. It is not model of real world.
It needs to evolve iteratively to keep itself useful.
Domain model is expressed in code. Code model is bound to
analytical model through Ubiquitous Language.
Domain model
The code is primary expression of the domain model.
You should take care of keeping code and conceptual model
in sync.
If during implementation you need to express new ideas or
change meaning of already defined things, this should also be
reflected in the language you communicate with domain
expert.
The same care must be taken to handle changes coming from
business understanding or requirements changes.
Domain model
Patterns, Principles, and Practices of Domain-Driven Design by Scott Millet and Nick Tune
How to create a good model
• domain modelling is a team activity
• domain model is not a model of a real life
• model only what is relevant
• domain models are temporary useful
• be explicit with terminology
• limit your abstractions
• implement model in code early and often
• don’t stop at first good idea
Remember: All models are wrong, but some are useful
Event Storming Design Level
Event Storming Design Level
DDD Modeling Whirlpool
Context Maps
Context map define how different bounded contexts are
integrated (how they communicate with each other - at the
system level and at the teams level) and how language of
one context is translated into language of the other.
Context mapping strategies:
Shared Kernel, Customer/Supplier, Conformist,
Anti Corruption Layer, Separate Ways, Open/Host Service,
Published Language, Partnership
Excellent presentation on the subject:
https://speakerdeck.com/mploed/context-maps-an-enhanced-view
Aggregate - “clusters” of things tightly related together in
given context. Aggregate takes care of keeping its state
consistent and holding invariants.
Invariant is business rule / characteristic of a thing that state
must be compliant to.
From developers perspective Aggregate is a scope of
transactional processing. All things within aggregate are
saved successfully together or save fails reverting state to the
original one.
Aggregate Root - main element of aggregate, all access to
aggregate is performed only through the aggregate root.
Key Tactical Patterns - Aggregate
Aggregates - Example: Online Actions Bounded Context
Auction
Winning
Bid
Bid
MemberAuction
Item
Payment
Method
Category
Shipping
Method
Seller
Question
Answer
Aggregates - Example: Online Actions Bounded Context
Auction
Winning
Bid
Bid
MemberAuction
Item
Payment
Method
Category
Shipping
Method
Seller
Question
Answer
Good aggregate design rules
• design around domain invariants, keep inside only data that is
needed to hold invariants while supporting operations
• reference things outside only by ID
• favour small aggregates
• large aggregates degrade performance
• large aggregates are potential source of concurrent access
issues
• ignore user interface influences
• avoid dumb collections and containers
• don’t focus on HAS-A relationship, your data model is not
your aggregate model
• do not model real life, only your use case
Key Tactical Patterns - Domain Events
Domain Event - fact that describes something that happened
in your domain, something with business meaning.
Domain events are a tool that allows us to have
communication between aggregates.
Domain events live inside bounded context.
One aggregate subscribes to events of other aggregate and
adjust its state.
Application may subscribe to domain events to perform
technical actions: like e-mail sending.
Domain Events can contain references to domain objects in
scope of Bounded Context.
Key Tactical Patterns - Domain Events
There is also a completely different kind of Domain Events.
External Domain Events - that are used to communicate
between bounded context. This kind needs different
approach. Such events must be versioned and cannot carry
domain objects.
Tactical Patterns / DDD Design Building Blocks
Entities
Value Objects
Repositories
Domain Services / Policies
Specifications
Factories
Application Service / Command Handlers
DDD & Architecture
Popular architectures often used when doing DDD:
Onion Architecture
Ports and Adapters
CQRS
… any many many others
but remember
DDD is not architecture
DDD & Architecture: Onion
DDD & Architecture: Ports & Adapter (Hexagonal)
DDD & Architecture: CQRS
DDD Misconceptions
• DDD is technical thing
• DDD is about Entities, Value Objects, Repositories
• DDD requires usage of ORM, Spring, ...
• DDD is a framework
• DDD is architecture
DDD things to remember
DDD is great for:
- divide important stuff from less important :)
- focus on small but important part
- build shared language of the project that is used for
communication between devs and business
- build models through iterative collaboration with domain
experts
- move shared language from discussion and modelling
sessions into code
53
altkomsoftware.pl
github.com/asc-lab
@AltkomSC
asc-lab@altkom.pl

Mais conteúdo relacionado

Mais procurados

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignAndriy Buday
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignNader Albert
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slidesthinkddd
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignYoung-Ho Cho
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven DesignDavid Berliner
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsAlexander van Trijffel
 
Domain driven design
Domain driven designDomain driven design
Domain driven designits_skm
 
The Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsThe Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsNick Tune
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Alan Christensen
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#Pascal Laurin
 
Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithVictor Rentea
 

Mais procurados (20)

Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain Models
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
The Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsThe Art of Discovering Bounded Contexts
The Art of Discovering Bounded Contexts
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
 
Event storming
Event storming Event storming
Event storming
 

Semelhante a Domain Driven Design Introduction

Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignFrank Levering
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignMuhammad Ali
 
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
 
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven ArchitecturesLalit Kale
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In DesignSandro Mancuso
 
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016Sebastian Verheughe
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPChris Renner
 
How Custom is your Org? CEER at Dreamforce 2019
How Custom is your Org?  CEER at Dreamforce 2019How Custom is your Org?  CEER at Dreamforce 2019
How Custom is your Org? CEER at Dreamforce 2019Steven Herod
 
Domain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureDomain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureCan Pekdemir
 
Adopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAdopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAleix Morgadas
 
2011 iska - tim m - domain driven design
2011   iska - tim m - domain driven design2011   iska - tim m - domain driven design
2011 iska - tim m - domain driven designTim Mahy
 
Domain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic ApproachDomain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic ApproachPanagiotis Papaioannou
 
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
 

Semelhante a Domain Driven Design Introduction (20)

Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
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)
 
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven Architectures
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
Strategic Design by Architecture and Organisation @ FINN.no - JavaZone 2016
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
 
How Custom is your Org? CEER at Dreamforce 2019
How Custom is your Org?  CEER at Dreamforce 2019How Custom is your Org?  CEER at Dreamforce 2019
How Custom is your Org? CEER at Dreamforce 2019
 
Domain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal ArchitectureDomain Driven Design & Hexagonal Architecture
Domain Driven Design & Hexagonal Architecture
 
Adopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAdopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organization
 
Technical Debt.pptx
Technical Debt.pptxTechnical Debt.pptx
Technical Debt.pptx
 
DOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGNDOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGN
 
2011 iska - tim m - domain driven design
2011   iska - tim m - domain driven design2011   iska - tim m - domain driven design
2011 iska - tim m - domain driven design
 
DDD
DDDDDD
DDD
 
Software Design principales
Software Design principalesSoftware Design principales
Software Design principales
 
Domain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic ApproachDomain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic Approach
 
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"
 

Último

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
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
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Último (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
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...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
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
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
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
 
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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Domain Driven Design Introduction

  • 1. ● Chcesz pracować w LAB? Pisz śmiało! ● Chcesz zrobić swoje zadanie rozwojowe we współpracy z LAB? Pisz śmiało! ● Masz propozycję tematu, który mógłby zostać rozpoznany przez LAB? Pisz śmiało!
  • 2. Wojtek Suwała, ASC LAB Head Architect Domain Driven Design Introduction for the Software House
  • 4. We must be doing something wrong ... We are developing software since 1960’s, yet: • From 2011 to 2015 the percentage of successful IT projects remains unchanged on a level of just 22% • Over 19% of all projects failed • The rest have experienced challenges https://www.projectsmart.co.uk/white-papers/chaos-report.pdf
  • 6. Good complexity :) Domain logic complexity inherent to the domain itself. Bad complexity :( Accidental complexity from: • mixing problem space with solution space • lack of understanding of business domain • mixing technical solution complexities
  • 7. Mixing domain complexity with technical complexity
  • 10.
  • 11.
  • 12. Domain-Driven Design is a language and domain-centric approach to software design for complex problem domains. The term was coined by Eric Evans in his Complexity from the domain is inherent seminal book “Domain-Driven Design: Tackling Complexity in the Heart of Software”. It consists of a collection of patterns, principles and practices that will enable teams to focus on what is core to the success of the business while crafting software that manages complexity in both the technical and business spaces. How about doing it right
  • 13. What do you mean when you say Software Development? Software development is a collaborative learning process involving developers and business experts.
  • 14. Problem Space • Understanding customer’s business domain • Building shared language • What is our customer’s core business? • What are customer’s goals? • What problems we are trying to solve? • Where our customer can gain / lose money?
  • 15. Big Picture Event Storming
  • 17. Big Picture Exploration Outcomes: • Better understanding of business domain • Initial business concepts definitions • Hot spots and opportunities revealed • Big Domain initially divided into smaller parts - subdomains
  • 18. Not All Parts Of The Problem Are Equal
  • 20. Subdomain types Core domain - the core thing identifies customer’s business and distinguished them from competitors. This is where we should focus on and where we can send our best troops. Supporting domains - things that must be done in order to support core business but are not unique. No need to spend lot of time modelling it. Probably existing patterns can be used. Less skilled teams can be assigned. Generic domains - things most enterprises do in the same way. Can be bought/outsourced.
  • 21. Supporting / generic subdomains
  • 22. Subdomains - Finding Core Agile Estimation can be used to identify Core and where we should apply DDD tactical patterns versus CRUD. On the other side, there is the Complexity/Cost that is associated with implementing software to manage the Bounded Context. Subdomains with Large Competitive Advantage and Large Complexity/Cost are the ones we should focus our effort on. Alternatively use Impact Mapping.
  • 23. Solution Space Defining right solution to the right problem with a little help of … • Bounded Contexts • Models • Ubiquitous Language • Context Maps
  • 24. Corporate Model Anti-Pattern Developers and Analysts are often trying to create one big model that has all data and handles all the use cases. We try to “sum up” many people different views on given term. This approach leads to having brittle, complex models full of unnecessary abstractions. It brings lots of accidental complexity to our solution. Such model is hard to extend and maintain over time. It is makes dividing work and responsibility to teams very hard.
  • 25. Don’t put everything into one model Policy Create Offer, Buy Policy Annex, Terminate Register Case Approve Case Payment Register Payment Change Payment Schedule Create Renewal Offer, Renew Calculate Reserves Calculate Commission Renewals Claims handling Payments Accounting & Reporting Sales Policy Management
  • 26. Don’t put everything into one model pictures from https://refactoring.guru/smells/large-class
  • 27. Bounded Context & Ubiquitous Language Bounded contexts divide solution space into smaller parts where we work on smaller models. Bounded context defines applicability of the model. It gives clarity on what is model used for, where is should be consistent and what it should ignore. Bounded context protects model inside it from things outside of it. Model should only change to better support functionality it is designed for, not due to requirements external to it. Bounded context gives team assigned to it autonomy and protection.
  • 28. Bounded Context & Ubiquitous Language Given domain term has precise meaning in given context. Project language shared between devs and customer and reflected in code must be precise in given bounded context.
  • 29. Bounded Context & Ubiquitous Language Example: E-Commerce System Product in context of Sales is described by price, available models, technical specification. It exposes two capabilities: can be sold and can be found by various criteria. Product in context of Shipping is described in terms of weight, package size, package handling rules, warehouse location and stock. It exposes capabilities: can be found, can be shipped, new stock can be placed and located.
  • 30. Bounded Context & Ubiquitous Language Bounded contexts should be created around business capability, not around data. Bounded contexts tend to align with customer organization’s structure - Conway’s Law
  • 31.
  • 32. What is domain model? Domain model is central part of Domain Driven Design. We focus on creation and further enhancements of domain models. It’s first version comes as analytical model from collaboration of devs and business experts during design and knowledge crunching sessions. It represents view of the domain needed to support business use case. It is not model of real world. It needs to evolve iteratively to keep itself useful. Domain model is expressed in code. Code model is bound to analytical model through Ubiquitous Language.
  • 33. Domain model The code is primary expression of the domain model. You should take care of keeping code and conceptual model in sync. If during implementation you need to express new ideas or change meaning of already defined things, this should also be reflected in the language you communicate with domain expert. The same care must be taken to handle changes coming from business understanding or requirements changes.
  • 34. Domain model Patterns, Principles, and Practices of Domain-Driven Design by Scott Millet and Nick Tune
  • 35. How to create a good model • domain modelling is a team activity • domain model is not a model of a real life • model only what is relevant • domain models are temporary useful • be explicit with terminology • limit your abstractions • implement model in code early and often • don’t stop at first good idea Remember: All models are wrong, but some are useful
  • 39. Context Maps Context map define how different bounded contexts are integrated (how they communicate with each other - at the system level and at the teams level) and how language of one context is translated into language of the other. Context mapping strategies: Shared Kernel, Customer/Supplier, Conformist, Anti Corruption Layer, Separate Ways, Open/Host Service, Published Language, Partnership Excellent presentation on the subject: https://speakerdeck.com/mploed/context-maps-an-enhanced-view
  • 40. Aggregate - “clusters” of things tightly related together in given context. Aggregate takes care of keeping its state consistent and holding invariants. Invariant is business rule / characteristic of a thing that state must be compliant to. From developers perspective Aggregate is a scope of transactional processing. All things within aggregate are saved successfully together or save fails reverting state to the original one. Aggregate Root - main element of aggregate, all access to aggregate is performed only through the aggregate root. Key Tactical Patterns - Aggregate
  • 41. Aggregates - Example: Online Actions Bounded Context Auction Winning Bid Bid MemberAuction Item Payment Method Category Shipping Method Seller Question Answer
  • 42. Aggregates - Example: Online Actions Bounded Context Auction Winning Bid Bid MemberAuction Item Payment Method Category Shipping Method Seller Question Answer
  • 43. Good aggregate design rules • design around domain invariants, keep inside only data that is needed to hold invariants while supporting operations • reference things outside only by ID • favour small aggregates • large aggregates degrade performance • large aggregates are potential source of concurrent access issues • ignore user interface influences • avoid dumb collections and containers • don’t focus on HAS-A relationship, your data model is not your aggregate model • do not model real life, only your use case
  • 44. Key Tactical Patterns - Domain Events Domain Event - fact that describes something that happened in your domain, something with business meaning. Domain events are a tool that allows us to have communication between aggregates. Domain events live inside bounded context. One aggregate subscribes to events of other aggregate and adjust its state. Application may subscribe to domain events to perform technical actions: like e-mail sending. Domain Events can contain references to domain objects in scope of Bounded Context.
  • 45. Key Tactical Patterns - Domain Events There is also a completely different kind of Domain Events. External Domain Events - that are used to communicate between bounded context. This kind needs different approach. Such events must be versioned and cannot carry domain objects.
  • 46. Tactical Patterns / DDD Design Building Blocks Entities Value Objects Repositories Domain Services / Policies Specifications Factories Application Service / Command Handlers
  • 47. DDD & Architecture Popular architectures often used when doing DDD: Onion Architecture Ports and Adapters CQRS … any many many others but remember DDD is not architecture
  • 49. DDD & Architecture: Ports & Adapter (Hexagonal)
  • 51. DDD Misconceptions • DDD is technical thing • DDD is about Entities, Value Objects, Repositories • DDD requires usage of ORM, Spring, ... • DDD is a framework • DDD is architecture
  • 52. DDD things to remember DDD is great for: - divide important stuff from less important :) - focus on small but important part - build shared language of the project that is used for communication between devs and business - build models through iterative collaboration with domain experts - move shared language from discussion and modelling sessions into code