SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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 DesignNader Albert
 
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 (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
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
 
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
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
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
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven DesignDavid Berliner
 
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 - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and MicroservicesDomain Driven Design - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and MicroservicesRadosław Maziarka
 
Domain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureDomain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureCrishantha Nanayakkara
 
Baby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignBaby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignŽilvinas Kuusas
 

La actualidad más candente (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
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 DesignDomain Driven Design
Domain Driven Design
 
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 (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
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
 
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
 
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
 
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
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
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 - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and MicroservicesDomain Driven Design - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and Microservices
 
Domain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal ArchitectureDomain Driven Design and Hexagonal Architecture
Domain Driven Design and Hexagonal Architecture
 
Baby steps to Domain-Driven Design
Baby steps to Domain-Driven DesignBaby steps to Domain-Driven Design
Baby steps to Domain-Driven Design
 
Refactoring
RefactoringRefactoring
Refactoring
 

Similar 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
 
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...apidays
 

Similar 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
 
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"
 
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...
apidays London 2023 - Why and how to apply DDD to APIs, Radhouane Jrad, QBE E...
 

Último

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Último (20)

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

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