SlideShare uma empresa Scribd logo
1 de 23
Domain Driven
Design
Fred Verheul
DDD Europe 2018
2
Agenda
• What is Domain Driven Design?
• Strategic patterns
• Tactical patterns
• Toolkit
3
What is Domain Driven Design (DDD)
• Not a technology or methodology
• Set of principles & patterns for focusing the design effort where it matters
most
• It’s all about:
• Understanding of the domain (subject area) where the software will be applied
• Creating a highly expressive model of that domain
• Distilling “Ubiquitous Language”
• Prerequisite: on-going collaboration between developers + domain experts
• When to apply: complex problems, high expectations
4
Ubiquitous Language
5
Domain Expert
Analyst Developer
Developer
Ubiquitous
Language
Application
code
Test code
Specs and
Documentation
Whiteboard
discussions
Strategic Patterns: Bounded Context
6
Context Map(-ping)
7
Tactical patterns: Building Blocks
• Value Objects
• Entities
• Aggregate Roots
• Repositories
• Services
• Factories
• Domain Events
8
Value Objects vs Entities
Entities:
Objects with an identity and a state
State evolves as long as application lives
Generally with a DB counterpart
Identifier Equality
9
Value Objects:
Have no conceptual identity
Can be designed as immutable
Can be shared between different entities
Structural Equality
Aggregates
• Cluster of objects
• Consistency Boundary
• Master object = aggregate root
10
Example, part 1 (Alberto Brandolini)
User Story 1:
As a Customer
I want to place an order
In order to purchase some goods
11
Example, part 2 (Alberto Brandolini)
User story 2, Returning
Customer:
As a customer
I want to retrieve my profile
in order to place more orders
12
Example, part 3 (Alberto Brandolini)
User story 3, Different
shipping address:
As a customer
I want to specify a valid
shipping address
In order to ship to a different
destination
13
Example, part 4 (Alberto Brandolini)
User story 4, Editable
customer profile:
As a customer
I want to edit my profile
In order to update it if
needed
14
Example, part 5 (Alberto Brandolini)
User story 5, Specify Billing
and Shipping Address:
As a customer
I want to specify
independent billing and
shipping addresses
In order to deliver goods to
different locations
15
Example, part 6 (Alberto Brandolini)
User story 6, Track past
orders:
As a Legal Department
I want to track orders
In order to manage
litigations
16
Result of modeling to deeper insights
17
Toolkit
• Tactical patterns (discussed above)
• Property based testing
• CQRS (Command Query Responsibility Segregation)
• Event sourcing
• Hexagonal Architecture
• Refactoring (to domain objects)
• Event Storming
18
Domain Driven Design
19
Further reading
• Udi Dahan: http://udidahan.com
• On CQRS: http://udidahan.com/2009/12/09/clarified-cqrs/
• Martin Fowler: https://martinfowler.com/intro.html
• On Event Sourcing: https://martinfowler.com/eaaDev/EventSourcing.html
• Greg Young:
• On CQRS: https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf
• Vaughn Vernon: https://vaughnvernon.co/
• On designing aggregates: https://vaughnvernon.co/?p=838
20
Further reading on property based testing
• http://blog.jessitron.com/2013/04/property-based-testing-what-is-it.html
• https://hypothesis.works/articles/what-is-property-based-testing/
• https://fsharpforfunandprofit.com/posts/property-based-testing/
• https://propertesting.com/book_foundations_of_property_based_testing.html
• http://www.erikschierboom.com/2016/02/22/property-based-testing/
21
Further reading
• Hexagonal Architecture:
• http://alistair.cockburn.us/Hexagonal+architecture
• https://www.infoq.com/news/2014/10/exploring-hexagonal-architecture
• Refactoring:
• https://refactoring.com/
22
Thank You
www.soapeople.com
info@soapeople.com
@SOAPEOPLE
Fred Verheul
Development Consultant
+31 6 3919 2986
fred.verheul@soapeople.com

Mais conteúdo relacionado

Semelhante a DDD Intro

Raja_Prabhu_Temenos
Raja_Prabhu_TemenosRaja_Prabhu_Temenos
Raja_Prabhu_Temenos
Rajaprabhu S
 
Srikanth Gattu-SharePoint Developer
Srikanth Gattu-SharePoint DeveloperSrikanth Gattu-SharePoint Developer
Srikanth Gattu-SharePoint Developer
srikanth gattu
 
10 tips for enabling data discovery and governance in your organization
10 tips for enabling data discovery and governance in your organization10 tips for enabling data discovery and governance in your organization
10 tips for enabling data discovery and governance in your organization
HostedbyConfluent
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
Tom Hofte
 

Semelhante a DDD Intro (20)

Raja_Prabhu_Temenos
Raja_Prabhu_TemenosRaja_Prabhu_Temenos
Raja_Prabhu_Temenos
 
Srikanth Gattu-SharePoint Developer
Srikanth Gattu-SharePoint DeveloperSrikanth Gattu-SharePoint Developer
Srikanth Gattu-SharePoint Developer
 
Domain Driven Design @ NewStore
Domain Driven Design @ NewStoreDomain Driven Design @ NewStore
Domain Driven Design @ NewStore
 
MongoDB World 2018: Data Analytics with MongoDB
MongoDB World 2018: Data Analytics with MongoDBMongoDB World 2018: Data Analytics with MongoDB
MongoDB World 2018: Data Analytics with MongoDB
 
10 tips for enabling data discovery and governance in your organization
10 tips for enabling data discovery and governance in your organization10 tips for enabling data discovery and governance in your organization
10 tips for enabling data discovery and governance in your organization
 
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
 
GRUG 2.0 6 Digital Guerrilla Validation 20180503
GRUG 2.0 6 Digital Guerrilla Validation 20180503GRUG 2.0 6 Digital Guerrilla Validation 20180503
GRUG 2.0 6 Digital Guerrilla Validation 20180503
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Lavacon 2014: But will it fit in my bathroom? Creating a single interface for...
Lavacon 2014: But will it fit in my bathroom? Creating a single interface for...Lavacon 2014: But will it fit in my bathroom? Creating a single interface for...
Lavacon 2014: But will it fit in my bathroom? Creating a single interface for...
 
FIWARE Wednesday Webinars - Cities as Enablers of the Data Economy: Smart Dat...
FIWARE Wednesday Webinars - Cities as Enablers of the Data Economy: Smart Dat...FIWARE Wednesday Webinars - Cities as Enablers of the Data Economy: Smart Dat...
FIWARE Wednesday Webinars - Cities as Enablers of the Data Economy: Smart Dat...
 
Webinar: Leveraging New Technologies with Migration
Webinar: Leveraging New Technologies with MigrationWebinar: Leveraging New Technologies with Migration
Webinar: Leveraging New Technologies with Migration
 
SharePoint Custom Development
SharePoint Custom DevelopmentSharePoint Custom Development
SharePoint Custom Development
 
Kaggle Vs Real-world Projects
Kaggle Vs Real-world ProjectsKaggle Vs Real-world Projects
Kaggle Vs Real-world Projects
 
Introduction to Smart Data Models
Introduction to Smart Data ModelsIntroduction to Smart Data Models
Introduction to Smart Data Models
 
Building a modern in-house analytics pipeline
Building a modern in-house analytics pipelineBuilding a modern in-house analytics pipeline
Building a modern in-house analytics pipeline
 
Solving Real World Challenges with Enterprise Search
Solving Real World Challenges with Enterprise SearchSolving Real World Challenges with Enterprise Search
Solving Real World Challenges with Enterprise Search
 
Webinar: How to Drive Business Value in Financial Services with MongoDB
Webinar: How to Drive Business Value in Financial Services with MongoDBWebinar: How to Drive Business Value in Financial Services with MongoDB
Webinar: How to Drive Business Value in Financial Services with MongoDB
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation Portal
 
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorialO'Reilly SACon San Jose, CA - 2019 - API design tutorial
O'Reilly SACon San Jose, CA - 2019 - API design tutorial
 

Último

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
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Último (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
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
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
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
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
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
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 

DDD Intro

  • 3. Agenda • What is Domain Driven Design? • Strategic patterns • Tactical patterns • Toolkit 3
  • 4. What is Domain Driven Design (DDD) • Not a technology or methodology • Set of principles & patterns for focusing the design effort where it matters most • It’s all about: • Understanding of the domain (subject area) where the software will be applied • Creating a highly expressive model of that domain • Distilling “Ubiquitous Language” • Prerequisite: on-going collaboration between developers + domain experts • When to apply: complex problems, high expectations 4
  • 5. Ubiquitous Language 5 Domain Expert Analyst Developer Developer Ubiquitous Language Application code Test code Specs and Documentation Whiteboard discussions
  • 8. Tactical patterns: Building Blocks • Value Objects • Entities • Aggregate Roots • Repositories • Services • Factories • Domain Events 8
  • 9. Value Objects vs Entities Entities: Objects with an identity and a state State evolves as long as application lives Generally with a DB counterpart Identifier Equality 9 Value Objects: Have no conceptual identity Can be designed as immutable Can be shared between different entities Structural Equality
  • 10. Aggregates • Cluster of objects • Consistency Boundary • Master object = aggregate root 10
  • 11. Example, part 1 (Alberto Brandolini) User Story 1: As a Customer I want to place an order In order to purchase some goods 11
  • 12. Example, part 2 (Alberto Brandolini) User story 2, Returning Customer: As a customer I want to retrieve my profile in order to place more orders 12
  • 13. Example, part 3 (Alberto Brandolini) User story 3, Different shipping address: As a customer I want to specify a valid shipping address In order to ship to a different destination 13
  • 14. Example, part 4 (Alberto Brandolini) User story 4, Editable customer profile: As a customer I want to edit my profile In order to update it if needed 14
  • 15. Example, part 5 (Alberto Brandolini) User story 5, Specify Billing and Shipping Address: As a customer I want to specify independent billing and shipping addresses In order to deliver goods to different locations 15
  • 16. Example, part 6 (Alberto Brandolini) User story 6, Track past orders: As a Legal Department I want to track orders In order to manage litigations 16
  • 17. Result of modeling to deeper insights 17
  • 18. Toolkit • Tactical patterns (discussed above) • Property based testing • CQRS (Command Query Responsibility Segregation) • Event sourcing • Hexagonal Architecture • Refactoring (to domain objects) • Event Storming 18
  • 20. Further reading • Udi Dahan: http://udidahan.com • On CQRS: http://udidahan.com/2009/12/09/clarified-cqrs/ • Martin Fowler: https://martinfowler.com/intro.html • On Event Sourcing: https://martinfowler.com/eaaDev/EventSourcing.html • Greg Young: • On CQRS: https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf • Vaughn Vernon: https://vaughnvernon.co/ • On designing aggregates: https://vaughnvernon.co/?p=838 20
  • 21. Further reading on property based testing • http://blog.jessitron.com/2013/04/property-based-testing-what-is-it.html • https://hypothesis.works/articles/what-is-property-based-testing/ • https://fsharpforfunandprofit.com/posts/property-based-testing/ • https://propertesting.com/book_foundations_of_property_based_testing.html • http://www.erikschierboom.com/2016/02/22/property-based-testing/ 21
  • 22. Further reading • Hexagonal Architecture: • http://alistair.cockburn.us/Hexagonal+architecture • https://www.infoq.com/news/2014/10/exploring-hexagonal-architecture • Refactoring: • https://refactoring.com/ 22
  • 23. Thank You www.soapeople.com info@soapeople.com @SOAPEOPLE Fred Verheul Development Consultant +31 6 3919 2986 fred.verheul@soapeople.com

Notas do Editor

  1. Source: https://martinfowler.com/bliki/BoundedContext.html
  2. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  3. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  4. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  5. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  6. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  7. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html
  8. Source: http://ziobrando.blogspot.com/2010/06/about-entities-aggregates-and-data.html