Ddd reboot (english version)

1 075 vues

Publié le

Introduced by Eric Evans in 2004 via his Blue Book, Domain Driven Design (DDD) has received tremendous positive feedbacks from many developers & communities over the years. On the other hand, we have to admit that DDD has since not been widely used in the trenches or within most of our development projects... How can we explain such failure in its diffusion? Is DDD in itself difficult or is it just the way people used to present it which makes it hard to grasp and inaccessible? Through our various (more or less successful ;-) experiences, we will try to highlight what DDD is using a simple and more accessible approach. The opportunity for us is to show you how helpful it can be for your day-to-day projects. Wouldn't be the perfect time for all of us to ease the DDD onboarding for beginners and to reboot DDD for experts?

Publié dans : Ingénierie

Ddd reboot (english version)

  1. 1. #DDDREBOOT LET’S REBOOT DDD! THOMAS PIERRAIN - JEREMIE GRODZISKI @TPIERRAIN - @JGRODZISKI
  2. 2. #DDDREBOOT LET’S REBOOT DDD! THOMAS PIERRAIN - JEREMIE GRODZISKI @TPIERRAIN - @JGRODZISKI
  3. 3. #DDDREBOOT BEFORE WE BEGIN
  4. 4. #DDDREBOOT#DDDREBOOT
  5. 5. #DDDREBOOT DDD AROUND YOU? OK, BUT 13 YEARS AFTER… #DDDREBOOT
  6. 6. #DDDREBOOT THERE MUST BE A REASON…
  7. 7. #DDDREBOOT « TACTICAL PATTERNS », « BOUNDED CONTEXTS », « UBIQUITOUS LANGUAGE », ETC. #DDDREBOOT DOES IT NOT MEAN ANYTHING TO YOU?
  8. 8. #DDDREBOOT#DDDREBOOT
  9. 9. #DDDREBOOT ACTUALLY DDD…
  10. 10. #DDDREBOOT DOMAIN DRIVEN DESIGN, IS…
  11. 11. #DDDREBOOT TO FOCUS ON BUSINESS VALUE
  12. 12. #DDDREBOOT OUR FIRST WORK AS DEVELOPER? UNDERSTAND THE DOMAIN THAT WE’LL HAVE TO CODE
  13. 13. #DDDREBOOT A SET OF CONCEPTS THAT, THROUGH USE CASES, ALLOWS US TO SOLVE PROBLEMS DOMAIN?
  14. 14. #DDDREBOOT DOMAIN: DOUBLE ENTRY ACCOUNTING SOLVED PROBLEMS: TRACKING, ROBUSTNESS CONCEPTS: ACCOUNT, DEBIT, CREDIT, AMOUNT, ETC.
  15. 15. #DDDREBOOT DOMAIN: IDE SOLVED PROBLEMS: PRODUCTIVITY, INTEGRATION CONCEPTS: PROJECTS, FILES, ANALYSIS, REFACTORING, CVS, DEBUGGER, ETC.
  16. 16. #DDDREBOOT BUT DDD IS MOSTLY…
  17. 17. #DDDREBOOT #DDDREBOOT
  18. 18. #DDDREBOOT
  19. 19. #DDDREBOOT AS DEVELOPERS, WE FACE …
  20. 20. #DDDREBOOT 3 LEVELS
  21. 21. #DDDREBOOT IS / COMPANY APPLICATION / TEAM CODE / PAIR
  22. 22. #DDDREBOOT IS / COMPANY APPLICATION / TEAM CODE / PAIR
  23. 23. #DDDREBOOT IS / COMPANY APPLICATION / TEAM CODE / PAIR
  24. 24. #DDDREBOOT LEVEL 1 IS / COMPANY APPLICATION / TEAM CODE / PAIR
  25. 25. #DDDREBOOT QUESTION: WHAT’S THE FOLLOWING CODE DOES?
  26. 26. #DDDREBOOT
  27. 27. #DDDREBOOT SO? #DDDREBOOT
  28. 28. #DDDREBOOT DID YOU SEE SOME CODE SMELLS?
  29. 29. #DDDREBOOT Good code / Bad code
  30. 30. #DDDREBOOT #1 MAGIC NUMBERS
  31. 31. #DDDREBOOT #1 MAGIC NUMBERS #2 DUPLICATIONS
  32. 32. #DDDREBOOT #1 MAGIC NUMBERS #2 DUPLICATIONS #3 PRIMITIVE OBSESSION
  33. 33. #DDDREBOOT #1 MAGIC NUMBERS #2 DUPLICATIONS #3 PRIMITIVE OBSESSION #4 MIXED CONCERNS 
 (TECH-BIZ)
  34. 34. #DDDREBOOT #1 MAGIC NUMBERS #2 DUPLICATIONS #3 PRIMITIVE OBSESSION #4 MIXED CONCERNS 
 (TECH-BIZ) #5 FUZZY TERMINOLOGY (
  35. 35. #DDDREBOOT AND NOW CONCERNING THE DOMAIN…
  36. 36. #DDDREBOOT LET’S FIND THE IMPLICITS !
  37. 37. #DDDREBOOT FREE SHIPPING IF GREATER THAN 100? 100 WHAT?
  38. 38. #DDDREBOOT FIXED SHIPMENT COST? FREE SHIPPING IF GREATER THAN 100? 100 WHAT?
  39. 39. #DDDREBOOT FIXED SHIPMENT COST? FREE SHIPPING IF GREATER THAN 100? 100 WHAT? WEIGHT IN G? VARIABLE COST FOR EACH SENT KG?
  40. 40. #DDDREBOOT CURRENCY IN EUROS? FIXED SHIPMENT COST? WEIGHT IN G? VARIABLE COST FOR EACH SENT KG? FREE SHIPPING IF GREATER THAN 100? 100 WHAT?
  41. 41. #DDDREBOOT CURRENCY IN EUROS? FIXED SHIPMENT COST? WEIGHT IN G? VARIABLE COST FOR EACH SENT KG? SHIPPING OPTION? FREE SHIPPING IF GREATER THAN 100? 100 WHAT?
  42. 42. #DDDREBOOT CURRENCY IN EUROS? FIXED SHIPMENT COST? WEIGHT IN G? VARIABLE COST FOR EACH SENT KG? SHIPPING OPTION? FREE SHIPPING IF GREATER THAN 100? 100 WHAT? VARIABLE COST PER PRODUCT CATEGORY?
  43. 43. #DDDREBOOT MAKE THE IMPLICIT, EXPLICIT
  44. 44. #DDDREBOOT DDD VERSION #DDDREBOOT
  45. 45. #DDDREBOOT
  46. 46. #DDDREBOOT
  47. 47. #DDDREBOOT
  48. 48. #DDDREBOOT
  49. 49. #DDDREBOOT
  50. 50. #DDDREBOOT VALUE TYPE
  51. 51. #DDDREBOOT THE VALUE TYPE EXPRESS YOUR DOMAIN AND SWALLOW YOUR COMPLEXITY
  52. 52. #DDDREBOOT -VALUE TYPES- IT'S WHAT THEY ARE THAT IS IMPORTANT; NOT WHO THEY ARE
  53. 53. #DDDREBOOT -VALUE TYPES- Σ OF ATTRIBUTES MEANING
  54. 54. #DDDREBOOT -VALUE TYPES- Example
  55. 55. #DDDREBOOT -VALUE TYPES- A COLOR (RGB: 255-255-0) A SPEED OF 50 KM/H A BANK NOTE OF 10 € Examples
  56. 56. #DDDREBOOT -VALUE TYPES- IMMUTABLES BY DEFINITION RICH WITH DOMAIN LOGIC EQUALITY ON ATTRIBUTES COMPOSABLES (OPERATORS, FONCTIONS) AUTO-VALIDATING Characteristics
  57. 57. #DDDREBOOT -VALUE TYPES- “TRANSACTIONAL” CONSTRUCTOR OR OPERATION CONSTRAINTS ENFORCED BY THE CONSTRUCTOR, NOT BY THE OPERATIONS FAIL FAST NO SETTERS ! IMMUTABILITY, AUTO-VALIDATING Implementation
  58. 58. #DDDREBOOT -VALUE TYPES- Implementation RICH WITH DOMAIN LOGIC
  59. 59. #DDDREBOOT -VALUE TYPES- ON ALL THE ATTRIBUTES! Implementation STRONG UNICITY hashCode STRONG EQUALITY equals
  60. 60. #DDDREBOOT -VALUE TYPES- “SIDE-EFFECT FREE” FUNCTIONS out of the tar pit WE COMPOSE, AND PREFER RÉ-ASSIGNING INSTEAD OF CHANGING THE STATE LIKE BEFORE :-(
  61. 61. #DDDREBOOT ESSENTIAL COMPLEXITY ACCIDENTAL COMPLEXITY
  62. 62. #DDDREBOOT « VALUE OBJECT » #DDDREBOOT IN DDD, WE NAME THAT:
  63. 63. #DDDREBOOT « VALUE OBJECT » #DDDREBOOT IN DDD, WE NAME THAT: OXYMORON
  64. 64. #DDDREBOOT -VALUE TYPE- ELECTED BEST R.O.I. OF DDD LAND
  65. 65. #DDDREBOOT EXPRESS THE DOMAIN CODEBASE PROGRESSIVE INTRODUCTION / EXEMPLARY COMPLEXITY SWALLOWER SIMPLIFY REASONING (IMMUTABLE, THREAD-SAFE, TESTABLE) - VALUE TYPE - AN UNBEATABLE R.O.I.
  66. 66. #DDDREBOOT PLANT THE SEED OF THE DOMAIN INTO THE CODE THE VALUE TYPE
  67. 67. #DDDREBOOT MAKE THE IMPLICIT, EXPLICIT
  68. 68. #DDDREBOOT SHIPPING COST DECISION TABLE
  69. 69. #DDDREBOOT SHIPPING COST DECISION TABLE DATA LITERALS!
  70. 70. #DDDREBOOT AND, AS WE TALK ABOUT IMPLICIT…
  71. 71. #DDDREBOOT "I CAN'T LISTEN TO THAT MUCH WAGNER. I START GETTING THE URGE TO CONQUER POLAND" (WOODY ALLEN)
  72. 72. #DDDREBOOT “I CAN’T SEE THAT MUCH MANAGERS IN CODE. I START GETTING TO…» (JÉRÉMIE)
  73. 73. #DDDREBOOT SHOOT THE MANAGERS! ;-)
  74. 74. #DDDREBOOT MAKE THE IMPLICIT, EXPLICIT
  75. 75. #DDDREBOOT ANOTHER PROBLEM
  76. 76. #DDDREBOOT#DDDREBOOT
  77. 77. #DDDREBOOT LOST IN TRANSLATION #DDDREBOOT
  78. 78. #DDDREBOOT "IT'S DEVELOPER'S UNDERSTANDING, NOT YOUR KNOWLEDGE THAT BECOMES SOFTWARE!" Alberto BRANDOLINI 
 (facing non collaborative BAs)
  79. 79. #DDDREBOOT IN SOME CASES… #DDDREBOOT
  80. 80. #DDDREBOOT SOLUTION?
  81. 81. #DDDREBOOT SOLUTION? 1 LANGUAGE : YOUR USERS’S ONE!
  82. 82. #DDDREBOOT « THE UBIQUITOUS LANGUAGE » #DDDREBOOT IN DDD, IT’S NAMED:
  83. 83. #DDDREBOOT YES BUT, HOW DO WE DO WHEN…
  84. 84. #DDDREBOOT A « CUSTOMER » IT'S…
  85. 85. #DDDREBOOT SO, HOW DO WE DO?
  86. 86. #DDDREBOOT CONTEXT MATTERS
  87. 87. #DDDREBOOT CONTEXT A GROUP OF PERSONS SHARING THE SAME MEANING BEHIND WORDS.
  88. 88. #DDDREBOOT Context CRM / Sales Customer => Socio- Economic group & Center of Interest
  89. 89. #DDDREBOOT Context Accounting Customer  => Method of & Payment Period Context CRM / Sales Customer => Socio- Economic group & Center of Interest
  90. 90. #DDDREBOOT Context Order-Shipment Customer  => addresses, availability Context Accounting Customer  => Method of & Payment Period Context CRM / Sales Customer => Socio- Economic group & Center of Interest
  91. 91. #DDDREBOOT « BOUNDED CONTEXT » #DDDREBOOT IN DDD, WE NAME THAT:
  92. 92. #DDDREBOOT CRM / Sales Context Model and Language of Sales Orders / Shipment Context Model & language of Logistics Accounting Context Model and Language of Accounting
  93. 93. #DDDREBOOT CRM / Sales Context Model and Language of Sales Orders / Shipment Context Model & language of Logistics Accounting Context Model and Language of Accounting APP UI WEB API DATABASES APP UI APP UI APP UI DATABASES WEB API APP UI APP UI DATABASES BATCH USERS MANUAL USERS MANUAL
  94. 94. #DDDREBOOT
  95. 95. #DDDREBOOT CONTEXT PRODUCTS CATALOG CONTEXT « SEARCH » CONTEXT CLIENT & ORDERS ADS CONTEXTCONTEXT “RECOMMANDATIONS" CONTEXT « PROMOTIONS » CONTEXT « PRODUCT HIGHLIGHTING »
  96. 96. #DDDREBOOT LEVEL 2 IS / COMPANY APPLICATION / TEAM CODE / PAIR
  97. 97. #DDDREBOOT PROBLEM
  98. 98. #DDDREBOOT#DDDREBOOT
  99. 99. #DDDREBOOT#DDDREBOOT ONE THING CHANGES AND… #DDDREBOOT
  100. 100. #DDDREBOOT WHY SO MUCH DOMAIN TECHNICAL STUFF IN OUR CODEBASE?
  101. 101. #DDDREBOOT#DDDREBOOT
  102. 102. #DDDREBOOT SOLUTION? HEXAGONAL ARCHITECTURE
  103. 103. #DDDREBOOT THE WORLD DIVIDES IN 2 CATEGORIES… #DDDREBOOT
  104. 104. #DDDREBOOT OUTSIDE INSIDE
  105. 105. #DDDREBOOT DOMAIN INFRA (HTTP, Db, MoM,…)
  106. 106. #DDDREBOOT DOMAIN CODE DO NOT ENTER BUSINESS CODE ONLY INFRA CODE (Ports & Adapters DMZ)
  107. 107. #DDDREBOOT DOMAIN CODE DO NOT ENTER BUSINESS CODE ONLY INFRA CODE >> playground <<
  108. 108. #DDDREBOOT OUTSIDE INSIDE
  109. 109. #DDDREBOOT HEXAGONAL ≠LAYERS
  110. 110. #DDDREBOOT LAYERS ARCHITECTURE +—————————+ | PRESENTATION | +—————————+ | DOMAIN | +—————————+ | DATABASE | +—————————+
  111. 111. #DDDREBOOT +———————————————+ | PRESENTATION | DATABASE | … | +———————————————+ | DOMAIN | +———————————————+ HEXAGONAL ARCHITECTURE
  112. 112. #DDDREBOOT « Hexagonal Architecture ?!? (…) That pattern is fucking awesome! »
  113. 113. #DDDREBOOT ANOTHER PROBLEM
  114. 114. #DDDREBOOT LEGACY NAM’ #DDDREBOOT
  115. 115. #DDDREBOOT LEGACY NAM’ #DDDREBOOT
  116. 116. #DDDREBOOT LEGACY NAM’ (WAGNER’S VERSION)
  117. 117. #DDDREBOOT THE RECURRING QUESTION: DO WE REBUILD EVERYTHING FROM SCRATCH OR NOT?
  118. 118. #DDDREBOOT Legacy Application Context
  119. 119. #DDDREBOOT Legacy Application Context Well-crafted DDD Bubble Context
  120. 120. #DDDREBOOT Well-crafted DDD Bubble Context ANTI-CORRUPTION LAYER Legacy Application Context
  121. 121. #DDDREBOOT LEVEL 3 IS / COMPANY APPLICATION / TEAM CODE / PAIR
  122. 122. #DDDREBOOT THE PROBLEM
  123. 123. #DDDREBOOT#DDDREBOOT
  124. 124. #DDDREBOOT#DDDREBOOT
  125. 125. #DDDREBOOT#DDDREBOOT
  126. 126. #DDDREBOOT EVEN FOR #DDDREBOOT RELATIONS BASED ON POWER
  127. 127. #DDDREBOOT MAKE THE IMPLICIT, EXPLICIT
  128. 128. #DDDREBOOT#DDDREBOOT CONTEXT MAP EXPLICITS THE RELATIONS OF “POWER” BETWEEN TEAMS
  129. 129. #DDDREBOOT UPSTREAM / DOWNSTREAM « IF YOU ARE UPSTREAM AND YOU POLLUTE THE RIVER… … PEOPLE DOWNSTREAM WILL BE IMPACTED. NOT THE INVERSE. » METAPHOR OF THE RIVER FLOW
  130. 130. #DDDREBOOT « Search » Context Upstream downstream Products Catalog Context CONTEXT MAP
  131. 131. #DDDREBOOT « Search » Context U d Products Catalog Context CONTEXT MAP AN TI-CO RRU PTIO N LAYER
  132. 132. #DDDREBOOT UPSTREAM / DOWNSTREAM CUSTOMER - SUPPLIER CONFORMIST ANTI-CORRUPTION LAYER (ACL) SERVICE HOST SHARED KERNEL … SOME VOCABULARIES AND PATTERNS
  133. 133. #DDDREBOOT « CONTEXT MAP & STRATEGIC DESIGN » #DDDREBOOT IN DDD, WE NAME THAT:
  134. 134. #DDDREBOOT SO…
  135. 135. #DDDREBOOT BEFORE LEAVING
  136. 136. #DDDREBOOT DOMAIN DRIVEN DESIGN, IS…
  137. 137. #DDDREBOOT A LOT MORE ACCESSIBLE & USEFUL THAN IT MIGHT SEEMS
  138. 138. #DDDREBOOT STARTING MONDAY
  139. 139. #DDDREBOOT Ubiquitous Language Value types Entities Aggregates Repositories Factories Services Domain Events Model Driven Design Core Domain / Generic Subdomains Hexagonal Architecture* CQRS* Event Sourcing* Bubble Context Bounded Contexts Context Maps Anti-corruption Layer Event storming Customer / Supplier Distillation Shared Kernel Conformist … CODE LEVEL APP LEVEL ENTREPRISE LEVEL DDD BUILDING BLOCKS * : not DDD but friendly
  140. 140. #DDDREBOOT ON THE SHOULDERS OF GIANTS
  141. 141. #DDDREBOOT#DDDREBOOT THANK YOU ERIC !
  142. 142. #DDDREBOOT BUT SOMETIMES…
  143. 143. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD!
  144. 144. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! AN OPEN COMMUNITY OF PRACTITIONERS
  145. 145. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! AN OPEN COMMUNITY OF PRACTITIONERS 1. POPULARISING DDD BY BEING MORE ACCESSIBLE JARGON
  146. 146. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! AN OPEN COMMUNITY OF PRACTITIONERS 1. POPULARISING DDD BY BEING MORE ACCESSIBLE JARGON 2. CONTINUE TO ENRICH THE DDD TOOLBOX
  147. 147. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! 1. POPULARISING DDD BY BEING MORE ACCESSIBLE JARGON 2. CONTINUE TO ENRICH THE DDD TOOLBOX AN OPEN COMMUNITY OF PRACTITIONERS
  148. 148. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! @DDDreboot + ALL TOGETHER LET’S MAKE DDD MAINSTREAM
  149. 149. #DDDREBOOT#DDDREBOOT LET’S REBOOT DDD! 1. POPULARISING DDD BY BEING MORE ACCESSIBLE JARGON 2. CONTINUE TO ENRICH THE DDD TOOLBOX @DDDreboot + AN OPEN COMMUNITY OF PRACTITIONERS

×