Introduction au DDD sous l’angle stratégique — hyf mai 2020

Introduction au DDD sous l’angle stratégique — hyf mai 2020

Le DDD, est une approche de la conception logicielle dirigée par le domaine, fondée sur deux principes :

- les conceptions complexes doivent être basées sur un modèle
- l’accent doit être sur le domaine et la logique associée

Dans cette présentation nous nous intéressons à la partie essentielle, mais souvent oubliée du DDD : les patterns stratégiques.

Beb422437c1dfb5366f197919e41ac50?s=128

Arnaud LEMAIRE

May 19, 2020
Tweet

Transcript

  1. www.lilobase.me The strategies behind DDD @lilobase #MeetupDeconfinement lgo.group

  2. Let’s start a new project !

  3. Let’s start a new project ! We just receive the

    customer’s requirements, we still need to clarify a few things. But you can start the preliminary design phase ! Let's do a sprint zero !
  4. SQL or NoSQL ? Java or C# ? Spring Boot

    or Quarkus ? PostgreSQL or MySQL ? Kafka or Redis ? Microservices or Monolith ? Kubernetes or Nomad ? Angular or React ?
  5. What are you working on ? There are still some

    uncertainties, but we’re gonna use kafka …
  6. Java or C# ? PostgreSQL or MySQL ? Kafka or

    Redis ? Microservices or Monolith ? Kubernetes or Nomad ? SQL or NoSQL ? Spring Boot or Quarkus ? These issues address only the solution
  7. Java or C# ? PostgreSQL or MySQL ? Kafka or

    Redis ? Microservices or Monolith ? Kubernetes or Nomad ? SQL or NoSQL ? Spring Boot or Quarkus ? These issues address only the solution But not the problem What should we do ?
  8. These issues address only the solution But not the problem

    What should we do ? How are we going to do it ?
  9. These issues address only the solution And that's why we

    keep being treated as technical specialists
  10. These issues address only the solution It is an important

    discussion to have But not the problem But only after we've figured out what to do
  11. These issues address only the solution And are the hardest

    to refactor
  12. Let’s rewind

  13. Let’s start a new project !

  14. Let’s start a new project ! We just receive the

    customer’s requirements, we still need to clarify a few things. But you can start the preliminary design phase ! Let's do a sprint zero !
  15. I heard about « Domain Driven Design », maybe we

    should use it ! Yeah, that's a great idea.
  16. Aggregate Repository Bounded Context as Microservices Domain Service Event Driven

    CQRS Entity Value Object Hexagonal Architecture
  17. What are you working on ? There are still some

    uncertainties, but we’re gonna use an event-driven hexagonal architecture …
  18. These issues still address only the solution Aggregate Repository Bounded

    Context as Microservices Domain Service CQRS Entity Value Object Hexagonal Architecture Event Driven
  19. These issues still address only the solution This is what

    we call « DDD Lite »
  20. These issues still address only the solution And that's why

    we keep being treated as technical specialists
  21. www.lilobase.me DDD is all about Alignment @lilobase

  22. DDD is all about Alignment What should we do ?

    How are we going to do it ?
  23. DDD is all about Alignment What should we do ?

    How are we going to do it ?
  24. Domains & Subdomains Business Domain discovery THE Software Authoring &

    Publishing Printing & Supply Chain Customer Care Retail Store You need to acknowledge the fact that you have several domains
  25. Retail Store Inventory Customer Care Shipping Only one VP should

    be angry at a time Retail Store Inventory Customer Care Shipping Authoring & Publishing Printing & Supply Chain Customer Care Retail Store Domains & Subdomains Business Domain discovery
  26. Retail Store Inventory Customer Care Shipping These are neither Bounded

    Contexts nor Microservices Authoring & Publishing Printing & Supply Chain Customer Care Retail Store Domains & Subdomains Business Domain discovery
  27. Retail Store Inventory Customer Care Shipping These are your domains

    Authoring & Publishing Printing & Supply Chain Customer Care Retail Store Domains & Subdomains Business Domain discovery
  28. Your domains contain domains Domains & Subdomains Business Domain discovery

    Online Retail Store Payment processor Catalogue Invoicing
  29. Domain Mapping Business Domain Classification Authoring Plateform Publishing & Printing

    Inventory Management Payment Processor Catalogue Invoicing Shipping Order Processing Proofreading
  30. Supporting Subdomain Generic Subdomain Core (sub)Domain Key differentiator Domains &

    Subdomains Business Domain Classification Essential to the organization’s success Required for the organization’s success Critical to the organization’s success
  31. Domains & Subdomains Business Domain Classification Authoring Plateform Inventory Management

    Shipping Payment Processor Catalogue Invoicing Order Processing Publishing & Printing Proofreading
  32. Domains & Subdomains Business Domain Classification Authoring Plateform Inventory Management

    Payment Processor Catalogue Invoicing Each business context is specific Shipping Order Processing Publishing & Printing Proofreading
  33. Authoring Plateform Domains’ Connexion Reveal Business Relationships Inventory Management Shipping

    Catalogue Invoicing Order Processing Payment Processor It can highlight significant sub-domain Publishing & Printing Proofreading
  34. www.lilobase.me DDD is all about Context @lilobase

  35. From Problem to Solution Business Domain & Architecture alignment Authoring

    Plateform Publishing & Printing Inventory Management Shipping Payment Processor Catalogue Invoicing Order Processing problem Proofreading
  36. From Problem to Solution Business Domain & Architecture alignment Authoring

    Plateform Publishing & Printing Inventory Management Shipping Payment Processor Catalogue Invoicing Order Processing problem solution Payment processor Invoicing Order Processing Shipping Authoring Plateforme Inventory Management Catalogue Publishing Proofreading Proofreading Inventory E-commerce platform Authoring Publishing
  37. Domains & Subdomains Development Strategy Supporting Subdomain In-House development with

    external support if possible Generic Subdomain Outsourcing is an option Core (sub)Domain In-House development with Your best teams Key differentiator
  38. Domains & Subdomains Development Strategy Supporting Subdomain Customized Off The

    Shelf Software is an option Generic Subdomain Try to find Off The Shelf solution Cost saving opportunities Core (sub)Domain Custom-made software High Cost & Quality Key differentiator
  39. From Problem to Solution Business Domain & Architecture alignment Authoring

    Plateform Publishing & Printing Inventory Management Shipping Payment Processor Catalogue Invoicing Order Processing problem solution Payment processor Invoicing Order Processing Shipping Authoring Plateforme Inventory Management Catalogue Publishing Proofreading Proofreading Inventory E-commerce platform Authoring Publishing
  40. From Problem to Solution Business Domain & Architecture alignment Authoring

    Plateform Publishing & Printing Inventory Management Shipping Payment Processor Catalogue Invoicing Order Processing problem solution Proofreading Inventory E-commerce platform Authoring Authoring Plateforme Publishing Catalogue Publishing Proofreading
  41. From Problem to Solution Business Domain & Architecture alignment Inventory

    E-commerce platform Authoring Authoring Plateforme Publishing Catalogue Publishing Proofreading These are your bounded contexts
  42. P Authoring Publishing E-commerce Stripe ShipMonk Shopify Context Mapping Relationship

    Hierarchy These are your bounded contexts OHS OHS ACL OHS C/S
  43. Authoring Publishing E-commerce Specific Architecture style You don’t need one

    architectural style Beware of the CRUD ES CQRS CRUD ? Stripe ShipMonk Shopify
  44. Stripe Still no microservices Bounded Context ≠ Deployment units ShipMonk

    Authoring Publishing E-commerce Shopify Deployment Unit
  45. Deployment Unit Stripe Still no microservices Bounded Context ≠ Deployment

    units ShipMonk Authoring Publishing E-commerce Shopify Deployment Unit
  46. Domains are not immutable Understanding is a never-ending process Stripe

    ShipMonk Authoring Publishing E-commerce Shopify Printing
  47. www.lilobase.me DDD is all about Boundaries @lilobase

  48. Semantic Boundaries Between BC meaning are different Authoring Publishing Book

    Chapter Chapter They are not the same book What happens if the author revises his book?
  49. Semantic Boundaries Between BC meaning are different Chapter This is

    why you must start by understand strategically your domain Author Book Reviews Release Catalogue
  50. Semantic Boundaries Between BC meaning are different Authoring Publishing Book

    Chapter Chapter Book Chapter Chapter Inside a Bounded Context, Don’t Repeat Yourself Between Bounded Context, Write Everything Twice
  51. Don’t cross them Between BC meaning are different Authoring Publishing

    Author Reviews Author Book Book Release Never create relationships between entities from two BC
  52. Don’t cross them Between BC meaning are different Authoring Publishing

    Book Book Release Author Author Reviews This is exactly the same
  53. Don’t cross them Between BC meaning are different Authoring Publishing

    Book Book Release Author Author Reviews API API
  54. Same for Events Between BC meaning are different Authoring Publishing

    This is exactly the same Event Bus Book Book Release Author Author Reviews
  55. Same for Events Between BC meaning are different Authoring Publishing

    Event Bus Book Book Release Author Author Reviews Translator Translator
  56. Transactional Boundaries Protect your integrity Authoring Book Chapter Chapter Chapter

    Statistics Inside your bounded Context live Entities They are grouped in Aggregates
  57. Transactional Boundaries Protect your integrity Book Chapter Chapter Chapter Statistics

    They are retrieved and persisted as a whole Inside an aggregate, Entities share the same lifecycle
  58. Transactional Boundaries Protect your integrity Book Chapter Chapter Chapter Statistics

    Who ensures the aggregate integrity All interactions are done through the Aggregate Root Write a new chapter
  59. Transactional Boundaries Protect your integrity Book Chapter Chapter Chapter Statistics

    Write a new chapter Chapter Inconsistency
  60. Transactional Boundaries Protect your integrity Book Chapter Chapter Chapter Statistics

    But don’t put to much in it Author What happens if we delete the book ? They must share the same lifecycle
  61. Transactional Boundaries Protect your integrity Book Chapter Chapter Chapter Statistics

    Author reference Author Id
  62. Designing Boundaries Protect your domain Printing Team We need printing

    margin Book Chapter Chapter Chapter Release We need the colorimetric profile Printing margin Colorimetric profile API Publishing Team
  63. Designing Boundaries Protect your domain API We need printing margin

    Book Chapter Chapter Chapter Release We need the colorimetric profile Printing margin Colorimetric profile Domain Leakage Publishing Team Printing Team
  64. Designing Boundaries Protect your domain Publishing Team Printing Team Publishing

    API We need printing margin Book We need the colorimetric profile Printing margin Colorimetric profile Printing API We discovered the need for an ACL
  65. www.lilobase.me DDD is all about Compassion @lilobase

  66. A A A Ubiquitous language Stakeholders & Team Alignement Dev

    Domain Expert Dev
  67. A A A not « just » a glossary Ubiquitous

    language Stakeholders & Team Alignement Dev Domain Expert Dev
  68. Ubiquitous language Each BC has its own Authoring Publishing A

    A
  69. Ubiquitous language Each BC has its own Authoring Publishing A

    A A A It is a common cause of miscommunication
  70. Pair Programing The best way to share a domain understanding

    Dev Domain Expert
  71. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User
  72. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User He has the last word regarding domain implementation
  73. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User Prioritize development & formalize users’ feedback
  74. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User Power of Life and Death over the project
  75. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User Too often forgotten
  76. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User Maybe you could spend a day per month working with them ?
  77. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User They design the software specification
  78. Know your users They might not be who you think

    they are Dev Domain Expert Product Owner Customer User What he understood goes into production
  79. “A loosely coupled software architecture and org structure to match”

    is a key predictor of: • Continuous Delivery Performance • Ability to scale organization and increase performance linearly This is what DDD is All About ! — Michael Plöd (@bitboss)
  80. www.lilobase.me Thanks @lilobase https://roti.express/r/ddd-hyf lgo.group