Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

DDD Intro

204 views

Published on

Introduction to DDD as presented at #sitnl 2018

Published in: Software
  • Be the first to comment

  • Be the first to like this

DDD Intro

  1. 1. Domain Driven Design Fred Verheul
  2. 2. DDD Europe 2018 2
  3. 3. Agenda • What is Domain Driven Design? • Strategic patterns • Tactical patterns • Toolkit 3
  4. 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. 5. Ubiquitous Language 5 Domain Expert Analyst Developer Developer Ubiquitous Language Application code Test code Specs and Documentation Whiteboard discussions
  6. 6. Strategic Patterns: Bounded Context 6
  7. 7. Context Map(-ping) 7
  8. 8. Tactical patterns: Building Blocks • Value Objects • Entities • Aggregate Roots • Repositories • Services • Factories • Domain Events 8
  9. 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. 10. Aggregates • Cluster of objects • Consistency Boundary • Master object = aggregate root 10
  11. 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. 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. 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. 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. 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. 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. 17. Result of modeling to deeper insights 17
  18. 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
  19. 19. Domain Driven Design 19
  20. 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. 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. 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. 23. Thank You www.soapeople.com info@soapeople.com @SOAPEOPLE Fred Verheul Development Consultant +31 6 3919 2986 fred.verheul@soapeople.com

×