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

Más contenido relacionado

Similar 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
 

Similar 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

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Último (20)

WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%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
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
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
 
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
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

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 del 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