Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DOMAIN DRIVEN DESIGN - English Handout

DOMAIN DRIVEN DESIGN - English Handout

WPS – Workplace Solutions

September 03, 2020
Tweet

More Decks by WPS – Workplace Solutions

Other Decks in Programming

Transcript

  1. www.wps.de WPS – Workplace Solutions Jörn Koch [email protected] @JoernKoch THE

    TRAINERS [email protected] @hofstef Dr. Stefan Hofer Kai Bühner [email protected] [email protected] @clemologe Clemens Heppner Richard Voß [email protected] @richard_voss Henning Schwentner [email protected] @hschwentner
  2. www.wps.de WPS – Workplace Solutions CONTENTS ▪ Overview – What

    is DDD? ▪ Knowledge Crunching ▪ Strategic Design based on Bounded Contexts ▪ Strategic Design based on Subdomains ▪ Context Mapping ▪ Ubiquitous Language ▪ Developing the Domain Model ▪ Tactical Design based on Building Blocks ▪ Optional ▪ Implementing the Building Blocks ▪ Design by Contract
  3. INTRODUCTION AND OVERVIEW Remote etikette: * Video on * Real

    name ‍♂️ »You‘re muted« »I‘d like to say something«
  4. INTRODUCTION AND OVERVIEW Ubiquitous Language Building Blocks Domain Event Aggregate

    Entity Value Object Bounded Context Strategic Design Context Mapping Collaborative Modeling Domain Expert Event Storming Modeling in Code Domain Storytelling Core Domain Microservices CQRS Hexagonal Architecture Agile Event Sourcing Extreme Programming Scrum Cloud Self-Contained Sytems Verticals Clean Architecture DevOps AWS Azure
  5. INTRODUCTION AND OVERVIEW My favorite technology My Questions My life

    as a developer / BA / PO / … My experiences using DDD My requests re the training iSAQB Modules
  6. INTRODUCTION AND OVERVIEW History of DDD Conways Law Blue Book

    Red Book 2015 ’16 ’17 ’14 ’13 ’12 2010 ’11 ’09 ’08 ’07 ’06 2005 ’04 ’03 ’02 2000 01 1968 ... ’99 ’98 ’19 2020 ’18
  7. INTRODUCTION AND OVERVIEW 13:00 19:00 places NAVIGATOR CAPTAIN 7 SHIP‘S

    SILHOUETTE on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE
  8. INTRODUCTION AND OVERVIEW Fach- sprache Domain Expert Developer Ludwig Wittgenstein

    »What one cannot talk about one can only be silent about.«
  9. INTRODUCTION AND OVERVIEW Depth Scale Silhouette Marking Depth Map move

    compute run aground neon yellow Ubiquitous Language
  10. INTRODUCTION AND OVERVIEW places NAVIGATOR CAPTAIN 7 SHIP‘S SILHOUETTE on

    SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE SMALL
  11. INTRODUCTION AND OVERVIEW class Silhouette { public void moveBy(Length l)

    //... public void twistBy(Angle a) //... } Erich Gamma “Program to an interface, not to an implementation”
  12. INTRODUCTION AND OVERVIEW 8 SHIP‘S SILHOUETTE and finds ROUTE NAVIGATOR

    <<Entity>> Silhouette moveBy(…) twistBy(…) Modeling in Code
  13. INTRODUCTION AND OVERVIEW ‍♂️ places NAVIGATOR CAPTAIN 7 SHIP‘S SILHOUETTE

    on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE
  14. KNOWLEDGE CRUNCHING @hschwentner Tools places NAVIGATOR CAPTAIN 7 SHIP‘S SILHOUETTE

    on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE
  15. KNOWLEDGE CRUNCHING fast intense ultra lightweight it‘s fun dive into

    the domain explore the limits experience the domain EVENT STORMING @JoernKoch
  16. KNOWLEDGE CRUNCHING EVENT STORMING @JoernKoch EVENT STORMING – Who invented

    it? Alberto Brandolini @ziobrando http://eventstorming.com
  17. KNOWLEDGE CRUNCHING Once upon a time… @JoernKoch A single example

    is way better than no example at all "Because sometimes three good examples are better for understanding the requirements than a bad abstraction." Peter Hruschka in Busines Analysis und Requirements Engineering, S.102, Hanser, 2014
  18. KNOWLEDGE CRUNCHING SCENARIO: MANEUVER PLANNING @ HAMBURG PORT DEPTH »10

    ft« SOUNDED DEPTH COLORED »RED« EVENT A RELEVANT DOMAIN EVENT Something happened here that GETS US FURTHER from a domain perspective! DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  19. KNOWLEDGE CRUNCHING DEPTH »10 ft« SOUNDED ORANGE STICKIE In PAST

    TENSE Tip: use UPPER CASE LETTERS EVENT DEPTH COLORED »RED« BE SPECIFIC! Other details = other story EVENT DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  20. KNOWLEDGE CRUNCHING DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« SCENARIO:

    MANEUVER PLANNING @ HAMBURG PORT SCENARIO: MANEUVER PLANNING @ HAMBURG PORT timeline DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  21. KNOWLEDGE CRUNCHING SCENARIO: MANEUVER PLANNING @ HAMBURG PORT DEPTH »10

    ft« SOUNDED DEPTH COLORED »RED« SCENARIO: MANEUVER PLANNING @ HAMBURG PORT DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  22. KNOWLEDGE CRUNCHING OPEN QUESTION or PROBLEM PINK STICKIE Short plain

    text description. Place close to events the hotspot is related to ! HOTSPOT DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« DONE!
  23. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS WPS – Workplace

    Solutions #dddkonkret www.wps.de STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  24. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    3 WPS – Workplace Solutions ▪ Our brain is far too tiny to understand the world as a whole! ▪ This is why we develop models ➢ we abstract ➢ we keep relevant stuff ➢ we drop irrelevant stuff HOW TO UNDERSTAND THE WORLD ? Foto: Maiconfz/pixabay/ CC0 Foto: Wikipedia/CC-PD 03.09.2020 //// Seite 4 WPS – Workplace Solutions WHEN OBSERVING A BASKETBALL GAME: DON‘T MIND THE GORILLA!
  25. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    5 WPS – Workplace Solutions MULTIPLE MODELS / SMALLER MODELS Foto: Maiconfz/pixabay/CCO Foto: Globus from book shelf/wikipedia/ CC-BY-3.0 Foto:Clker-Free-Vector-Images/pixabay/ CCO Foto: Wasserseemüller-Globus/Wikipedia/CC-PD-Mark 03.09.2020 //// Seite 6 WPS – Workplace Solutions ▪ »Newton was a genius, but not because of the superior computational power of his brain. Newton's genius was, on the contrary, his ability to simplify, idealize, and streamline the world so that it became, in some measure, tractable to the brains of perfectly ordinary men.« – Jerry Weinberg ISAAC NEWTON AND MODELS
  26. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    7 WPS – Workplace Solutions HOW TO UNDERSTAND THE DOMAIN AND BUILD SOFTWARE FOR IT ? ▪ Classic approach: ▪ Integrated monolithic software that takes care of anything a user could reasonably wish for! ▪ Central data base! ▪ Hope: ▪ Problems are solved once and for all! ▪ No redundant data! @hschwentner »Whoever uses a company-wide domain model has lost control over his life« – Karl Lagerfeld
  27. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    9 WPS – Workplace Solutions ▪ Multiple mixed-up mental models ▪ Unhandable amount of complexity ▪ Whack-the-mole side effects ▪ Dependencies among teams CLASSIC DOMAIN MODEL – REALITY CHECK Foto: CMS Higgs-even/Wikipedia/CC-BY-SA-3.0 03.09.2020 //// Seite 10 WPS – Workplace Solutions ▪ Usually the domain is to large to comprehend as a whole. ▪ Develop multiple smaller models. ▪ Build multiple smaller pieces of software – one for each model! HOW TO UNDERSTAND THE DOMAIN AND BUILD SOFTWARE FOR IT ?
  28. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS places NAVIGATOR CAPTAIN

    7 SHIP‘S SILHOUETTE on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE 03.09.2020 //// Seite 12 WPS – Workplace Solutions TIDE FORECAST DEPTHS SOUNDING MODELS @ HAMBURG PORT
  29. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    13 WPS – Workplace Solutions BOUNDED CONTEXTS ▪ Each model has its own context ▪ Context = Environment that provides domain terms with a specific meaning! ▪ Set explicit boundaries in ▪ team organisation ▪ code base ▪ data base schemes ▪ (source code) ▪ (deployment units) Foto: Bundesarchiv, Bild 173-1282/Helmut J. Wolf/Wikipedia/CC-BY-SA 3.0 IDENTIFYING SUBDOMAINS (aka „CUTTING THE DOMAIN“)
  30. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    15 WPS – Workplace Solutions FIND THE POINTS OF NO RETURN 03.09.2020 //// Seite 16 WPS – Workplace Solutions @JoernKoch POINTS OF NO RETURN Which domain events complete a sub-process with a working result that persists?
  31. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    17 WPS – Workplace Solutions FIND THE POINTS OF NO RETURN! DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 18 WPS – Workplace Solutions DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« FIND THE POINTS OF NO RETURN!
  32. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    19 WPS – Workplace Solutions DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« FIND THE POINTS OF NO RETURN! 03.09.2020 //// Seite 20 WPS – Workplace Solutions DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« FIND THE POINTS OF NO RETURN!
  33. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    21 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 22 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  34. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    23 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS BOUNDARY DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 24 WPS – Workplace Solutions DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« IDENTIFY THE SUBDOMAINS PIVOTAL EVENT
  35. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    25 WPS – Workplace Solutions DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« IDENTIFY THE SUBDOMAINS BOUNDARY EVENT @JoernKoch 03.09.2020 //// Seite 26 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH »10 ft« SOUNDED DEPTH COLORED »RED«
  36. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    27 WPS – Workplace Solutions @JoernKoch At a POINT OF NO RETURN everything can change into »something completely different« ARE THERE MORE SUBDOMAINS?
  37. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    29 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH »10 ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 30 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH ft« SOUNDED DEPTH COLORED »RED«
  38. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    31 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 32 WPS – Workplace Solutions IDENTIFY THE SUBDOMAINS DEPTH ft« SOUNDED DEPTH COLORED »RED« Tip: It‘s rather easy to name sub-processes. Go with those names and name subdomains correspondingly.
  39. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    33 WPS – Workplace Solutions SAVE THE RESULTS! 03.09.2020 //// Seite 34 WPS – Workplace Solutions PRACTICE: Find the points of no return and identify the cinema’s subdomains.
  40. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS places NAVIGATOR CAPTAIN

    7 SHIP‘S SILHOUETTE on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE DEPTH SOUNDING MANEUVER- PLANNING Group the steps: • Draw a boundary around activities and work objects. • Leave acteurs outside. Find a name for the sub domain places NAVIGATOR CAPTAIN 7 SHIP‘S SILHOUETTE on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE DEPTH SOUNDING MANEUVER- PLANNING Determine the parts of the subdomain that you actually want to build a software for (e. g. an MVP). Build a Bounded Context just for those.
  41. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    37 WPS – Workplace Solutions Common heuristics: ▪ Points of no Return (persistent work results) ▪ Borders within the process ▪ State changes, that affect the „nature“ of an aggregate (e. g. „contract legally binding“, „shopping cart ordered“) ▪ Departments of the organisation ▪ Contextual language ▪ Different usage of entities / aggregates ▪ NOT: by entities / aggregates! HOW TO CUT THE DOMAIN? Foto: Wikipedia/PD-ScottForesman 03.09.2020 //// Seite 39 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) send() places NAVIGATOR SHIP‘S SILHOUETTE on SOUNDING SERVICE DEPTH MAP DEPTH MAP
  42. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    40 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) send() 03.09.2020 //// Seite 41 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) send() mark() add(depth) computeContourLine(depth) …
  43. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    43 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) send() ✘
  44. STRATEGIC DESIGN – BASED ON BOUNDED CONTEXTS 03.09.2020 //// Seite

    44 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) <<Aggregate>> DepthMap send() Build multiple smaller pieces of software – one for each model! 03.09.2020 //// Seite 45 WPS – Workplace Solutions EVENT-DRIVEN ARCHITECTURE ▪ Bounded Contexts communicate their domain events! ▪ E.g. by sending messages. ▪ Loose coupling intended. ▪ Resemblance to Pipes-and-Filters architecture: ▪ „Messaging“ is „pipes“. ▪ „Bounded Contexts“ is „filters“ / „processors“ MANEUVER- PLANNING DEPTH MAP COMPLETED
  45. STRATEGIC DESIGN – BASED ON SUBDOMAINS WPS – Workplace Solutions

    #dddkonkret www.wps.de STRATEGIC DESIGN – BASED ON SUBDOMAINS Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  46. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 4

    WPS – Workplace Solutions PROBLEM SPACE VS SOLUTION SPACE ▪ Problem Space: ▪ Focus on business challenges. ▪ Pure domain logic. ▪ The domain consists of 1-n subdomains. ▪ Solution space: ▪ Focus on how to implement the software that helps us tackling business challenges. ▪ Based on specific technology. ▪ The software consists of 1-n bounded contexts. ▪ Each based on a subdomain-specific domain model. Foto: gerat/pixabay/CC0 03.09.2020 //// Seite 5 WPS – Workplace Solutions SUBDOMAINS ▪ The parts the domain consists of ▪ Separation of business concerns ▪ Already there (not to be designed) ▪ Problem space Foto: Wikipedia/CC BY-SA 2.5
  47. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 6

    WPS – Workplace Solutions BOUNDED CONTEXT VS SUBDOMAIN ▪ In greenfield software development BC and subdomain match 1:1. ▪ Whereas, in a greenfield startup phase the BC will probably not cover all parts of the subdomain it relates to. ▪ In brownfield software development mismatches are common (e. g. 1 system for n problems, n systems for 1 problem, overlapping / duplicate / missing responsibilities) ▪ Legacy systems often are »Unbounded Contexts« Two sides of a medal Foto: Dreibund Medaille/Wikipedia/CC BY-SA 3.0 03.09.2020 //// Seite 7 WPS – Workplace Solutions TIDE FORECAST DEPTHS SOUNDING MANEUVER PLANNING @ HAMBURG PORT: SUBDOMAINS == BOUNDED CONTEXTS TIDE FORECAST DEPTHS SOUNDING Subdomain Bounded Context
  48. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 8

    WPS – Workplace Solutions BILLING & INVOICE SUBDOMAINS / DEPARTMENTS VS BOUNDED CONTEXTS PAYMENT ACCOUNTING ▪ Intended is a 1:1 match of systems and subdomains ▪ Usually impossible in a brownfield environment. ▪ Can be impossible in a greenfield environment, too, because: ▪ (Unbounded) standard software must be used ▪ Technical reasons Subdomain BC / (3rd-party) system SALES 03.09.2020 //// Seite 9 WPS – Workplace Solutions MISMATCH: SYSTEMS vs SUBDOMAINS BIG BALL OF PAIN CORE MASTER BI SHIPPING ARTICLES TEAM STOCK TEAM BI TEAM SALES @JoernKoch
  49. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 10

    WPS – Workplace Solutions UNITS – business-wise, organizational, technical technical (SYSTEMS) business-wise (SUBDOMAINS) organizational (TEAMS) 03.09.2020 //// Seite 11 WPS – Workplace Solutions UNITS - EXAMPLE: technical CORE MASTER BI This is an (over-simplified) real-world example taken from a customer‘s project!
  50. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 12

    WPS – Workplace Solutions UNITS - EXAMPLE: business-wise vs. technical CORE MASTER BI SHIPPING ARTICLES 03.09.2020 //// Seite 13 WPS – Workplace Solutions UNITS – EXAMPLE: business-wise vs. technical vs. organizational CORE MASTER BI SHIPPING ARTICLES TEAM STOCK TEAM BI TEAM SALES
  51. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 14

    WPS – Workplace Solutions CORE MASTER BI SHIPPING ARTICLES TEAM STOCK TEAM BI TEAM SALES UNITS – EXAMPLE: business-wise vs. technical vs. organizational Fractions within units cause pain! • business pain • technical pain • organizational pain And it‘s complicated, too! BIG BALL OF PAIN 03.09.2020 //// Seite 15 WPS – Workplace Solutions UNITS – THE DDD WAY: business-wise ARTICLES SHIPPING
  52. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 16

    WPS – Workplace Solutions UNITS – THE DDD WAY: business-wise vs. technical SHIPPING ARTICLES 03.09.2020 //// Seite 17 WPS – Workplace Solutions UNITS – THE DDD WAY: business-wise vs. technical vs. organizational TEAM SHIPPING TEAM ARTICLES Units are actual units – with no fractions inside! • business-wise • technically • organizationally And it‘s so simple! Almost trivial.
  53. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 18

    WPS – Workplace Solutions UNITS – ALTERNATIVES: business-wise vs. technical vs. organizational CORE MASTER BI SHIPPING ARTICLES TEAM STOCK TEAM BI TEAM SALES NOTE: The same complexity in units on both sides! To be true: there is one technical unit (i. e. system) more on the right side ;) TEAM SHIPPING TEAM ARTICLES 03.09.2020 //// Seite 19 WPS – Workplace Solutions EACH BOUNDED CONTEXT CAN HAVE ITS OWN TEAM ▪ Teams develop independently. ▪ Each team is a single point of responsibility. ▪ Each team is stellar both domain- and technology-wise.
  54. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 20

    WPS – Workplace Solutions HORIZONTAL vs. VERTICAL LAYERS VERTICAL: business layers HORIZONTAL: technical layers ARTICLES SALES BILLING SHIPPING UI APPLICATION INFRASTRUCTURE DATABASE 03.09.2020 //// Seite 21 WPS – Workplace Solutions TEAM ASSIGNMENT – EXAMPLE 1 UI APPLICATION INFRASTRUCTURE DATABASE TEAM ARTICLES TEAM SALES TEAM SHIPPING TEAM BILLING VERTICAL: business layers HORIZONTAL: technical layers ARTICLES SALES BILLING SHIPPING
  55. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 22

    WPS – Workplace Solutions TEAM ASSIGNMENT – EXAMPLE 2 – UI as a BOUNDED CONTEXT? UI APPLICATION INFRASTRUCTURE DATABASE TEAM ARTICLES TEAM SALES TEAM SHIPPING TEAM BILLING TEAM WEBSHOP ? VERTICAL: business layers HORIZONTAL: technical layers ARTICLES SALES BILLING SHIPPING 03.09.2020 //// Seite 23 WPS – Workplace Solutions TEAM ASSIGNMENT – EXAMPLE 3 UI APPLICATION INFRASTRUCTURE DATABASE TEAM ARTICLES TEAM SHOP TEAM SHIPPING TEAM WEBSHOP ? ARTICLES SALES BILLING SHIPPING VERTICAL: business layers HORIZONTAL: technical layers
  56. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 24

    WPS – Workplace Solutions PRACTICE: Extract a graphical overview of the identified subdomains.
  57. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 26

    WPS – Workplace Solutions CORE DOMAIN ▪ Part of the business domain. ▪ Of crucial importance for the company's success. ➔ This is where the company has to stand out. ➔ This project should be given the highest priority. The software system that represents the core domain is a competitive advantage! It’s not a necessary evil. ➔ Unique Selling Point (USP) Foto: Pixeleye/pixabay/CC0 03.09.2020 //// Seite 27 WPS – Workplace Solutions SUPPORTING UND GENERIC SUBDOMAIN ▪ Supporting subdomain ▪ Models an aspect that can be critical but not part of the core. ▪ Usually specific for the business. ▪ Generic subdomain ▪ Not customer- or (sometimes) industry-specific. ▪ Required for the overall solution. ➔ Not unimportant! ➔ But also no need to be excellent here. Foto:Customer support/Sharique.m3em/Wikipedia/CC-BY-SA-4.0
  58. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 28

    WPS – Workplace Solutions SUBDOMAINS @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING 03.09.2020 //// Seite 29 WPS – Workplace Solutions KANO MODEL Satisfaction Degree of implementation Basic needs Performance needs Delighters How helpful are those in core / supporting / generic domains? Noriaki Kano
  59. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 30

    WPS – Workplace Solutions PARETO PRINCIPLE („80/20 RULE“) How acceptable is this in core / supporting / generic domains? 03.09.2020 //// Seite 31 WPS – Workplace Solutions BROWNFIELD STRATEGIC DESIGN ▪ Starting point: A confused monolithic Big Ball of Mud. ▪ Very likely: several mixed togeher domain models. ▪ Method: ▪ Identify the subdomains and unravel those mixed together domain models. ▪ Put up some meaningful boundaries! ➔ That‘s how we can handle complexity! ▪ Specific ubiquitous languages: ▪ Each Subdomain has its own specific ubiquitous language. ➔ Map to the legacy system‘s language in order to integrate old and new world. Foto: cpmacdonald/pixabay/CCO
  60. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 33

    WPS – Workplace Solutions HOW TO SPLIT THE MONOLITH 1. How should it be? 1. Collaborative Modeling 2. “ideal” context map 2. How is it? 1. Architecture Analysis 2. “Actual” context map 3. How to move the “actual” to the “ideal”? 1. Extract a supporting domain to learn 2. Then extract core(s) DEPTHS SOUNDING 03.09.2020 //// Seite 34 WPS – Workplace Solutions <<Aggregate>> DepthMap place(silhouette) send() <<Aggregate>> DepthMap place(silhouette) send() <<Aggregate>> DepthMap place(silhouette) send()
  61. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 35

    WPS – Workplace Solutions BOUNDED CONTEXT UND DEPLOYMENT Distributed Big Ball Of Mud „Modulith“ Microservices (Bounded Contexte) Monolithic Big Ball Of Mud 03.09.2020 //// Seite 36 WPS – Workplace Solutions FAKE TWINS SOA Bounded Context Architecture
  62. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 37

    WPS – Workplace Solutions @JoernKoch BIG BALL OF MUD Breadcoffeeknifegrinder breadslicingcoffeemachine saltkettleshakerdishwashing stovewaterkettlemachine 03.09.2020 //// Seite 38 WPS – Workplace Solutions @JoernKoch Bread coffee knife grinder bread slicing coffee machine salt kettle shaker dish washing stove water kettle machine BIG BALL OF MUD – CLEANING UP THE DUMP
  63. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 39

    WPS – Workplace Solutions @JoernKoch SOA Bread Kettle Dish Machine Slicing Coffee Knife Stove Water Salt Grinder Shaker Washing 03.09.2020 //// Seite 40 WPS – Workplace Solutions @JoernKoch Bread Kettle Dish Machine Slicing Coffee Knife Stove Water Salt Grinder Shaker Washing SOA
  64. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 41

    WPS – Workplace Solutions @JoernKoch Bread Machine Slicing SOA 03.09.2020 //// Seite 42 WPS – Workplace Solutions @JoernKoch Bread Dish Machine Slicing Knife Washing SOA
  65. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 43

    WPS – Workplace Solutions @JoernKoch Bounded Context Architecture Breadslicingmachine Dishwashingmachine Waterkettle Coffeegrinder Saltshaker Breadknife Stove Coffeekettle 03.09.2020 //// Seite 44 WPS – Workplace Solutions @JoernKoch Breadslicingmachine Dishwashingmachine Waterkettle Coffeegrinder Saltshaker Breadknife Stove Coffeekettle Bounded Context Architecture
  66. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 45

    WPS – Workplace Solutions @JoernKoch Bounded Context Architecture Breadslicingmachine 03.09.2020 //// Seite 46 WPS – Workplace Solutions @JoernKoch Breadslicingmachine Bounded Context Architecture Dishwashingmachine
  67. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 47

    WPS – Workplace Solutions @JoernKoch Breadslicingmachine Bounded Context Architecture Team A Team B Dishwashingmachine SOA Bounded Context Architecture 0:1 ?
  68. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 49

    WPS – Workplace Solutions @JoernKoch Bounded Context Architecture SOA SOA SOA 03.09.2020 //// Seite 50 WPS – Workplace Solutions TECHNICAL DOMAINS ▪ WHICH TEAM TAKES CARE OF ▪ OPERATING? ▪ MESSAGING infrastructure? ▪ development of a fancy UI WIDGET LIBRARY? ▪ … ▪ In addition to the DOMAIN problem areas, there are always TECHNICAL problem areas. ▪ APPROACHES: ▪ Each team takes care of all technical aspects themselves. ▪ Possibly supplemented by "Communities of Practice" or "Tribes“. ▪ Additional teams for "technical domains“.
  69. STRATEGIC DESIGN – BASED ON SUBDOMAINS 03.09.2020 //// Seite 51

    WPS – Workplace Solutions PRACTICE: Identify CORE domains? Plus supporting / generic? (Annotate “C” / “S” / “G”)
  70. CONTEXT MAPPING WPS – Workplace Solutions #dddkonkret www.wps.de CONTEXT MAPPING

    Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  71. CONTEXT MAPPING 03.09.2020 //// Seite 3 WPS – Workplace Solutions

    CONTEXT MAP ▪ Each team is aware of its context boundaries. But what is the overall picture? ▪ A context map shows ▪ all different bounded contexts ▪ and their mutual relationship. ▪ Bounded contexts should be named. 03.09.2020 //// Seite 4 WPS – Workplace Solutions CONTEXT MAP @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  72. CONTEXT MAPPING 03.09.2020 //// Seite 5 WPS – Workplace Solutions

    CONTEXT MAPPING ▪ Team collaboration ▪ Partnership ▪ Separate Ways ▪ Upstream / Downstream ▪ Customer / Supplier ▪ Conformist ▪ Technical integration ▪ Private Interface ▪ Open Host Service ▪ Shared Kernel ▪ Domain modeling ▪ Published Language ▪ Anticorruption Layer 03.09.2020 //// Seite 6 WPS – Workplace Solutions PARTNERSHIP ▪ The teams agree on the interface together ▪ Common goal / interdependent goals ▪ Teams can only be successful together ▪ Regular meetings ▪ Continuous integration ▪ Generally high synchronization effort → Is it an antipattern? Foto: Wikipedia/flickr/CC-BY Ryan C
  73. CONTEXT MAPPING 03.09.2020 //// Seite 7 WPS – Workplace Solutions

    UPSTREAM / DOWNSTREAM ▪ One team creates facts for another. ▪ Upstream team implements a model. ▪ Downstream team builds on it. ▪ Data flow vs. model specification →Data flow is usually trivial →More interesting: Which team specifies the common model that is used for inter-context communication? Foto: benralexander/pixabay/CC0 03.09.2020 //// Seite 8 WPS – Workplace Solutions CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  74. CONTEXT MAPPING 03.09.2020 //// Seite 9 WPS – Workplace Solutions

    CUSTOMER / SUPPLIER ▪ Supplier team provides data and/or services. ▪ Customer team uses the provided data and/or services. ▪ The supplier team can be influenced by the customer team (“Customer is King!”) ▪ Customer passes requirements on to supplier. Supplier handles requirements with the same priority as the customer handles his own requirements. → Is it an antipattern? Foto: Clker-Free-Vector-Images/pixabay/CC0 03.09.2020 //// Seite 10 WPS – Workplace Solutions CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  75. CONTEXT MAPPING 03.09.2020 //// Seite 11 WPS – Workplace Solutions

    CONFORMIST ▪ The upstream team does not implement any requirements of the downstream team. ▪ The downstream team adopts the model of the upstream team 1:1. Foto: Staff Sgt. D. Myles Cullen/Wikipedia/PD US Air Force 03.09.2020 //// Seite 12 WPS – Workplace Solutions CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  76. CONTEXT MAPPING 03.09.2020 //// Seite 13 WPS – Workplace Solutions

    ANTICORRUPTION LAYER ▪ The anti-corruption layer… ▪ is an architecture layer that mediates between the domain model and the model of an adjacent system. ▪ protects your own domain model from being unintentionally influenced by the model of the adjacent system. Domain Model Anticorruption Layer Adjacent System 03.09.2020 //// Seite 14 WPS – Workplace Solutions CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  77. CONTEXT MAPPING 03.09.2020 //// Seite 15 WPS – Workplace Solutions

    SEPARATE WAYS ▪ If integrating two bounded contexts makes no sense, let each team go their own way. ▪ Each team with their own specific solution. Foto: Doris Antony/Wikipedia/CC-BY-SA-4.0,3.0,2.5,2.0,1.0 03.09.2020 //// Seite 16 WPS – Workplace Solutions BIG BALL OF MUD ▪ THE context mapping antipattern. Foto: Benutzer:Summi/Wikipedia/CC-BY-SA-3.0-migrated
  78. CONTEXT MAPPING 03.09.2020 //// Seite 17 WPS – Workplace Solutions

    PRIVATE INTERFACE ▪ Defines a protocol / interface between 2 bounded contexts (Not in the "blue book".) ▪ Not open to others. ▪ Increases the mutual dependency of two contexts. ▪ Often not that well documented. Foto: 3D Tin Can Phones/flickr/C-BY Chris Potter 03.09.2020 //// Seite 18 WPS – Workplace Solutions OPEN HOST SERVICE ▪ Defines a protocol / interface of a bounded context as a set of services. ▪ Open == anyone can use the protocol. ▪ The resulting API is well defined and documented. ▪ Simplified model (least common denominator). Foto: edwardpye/pixabay/CC0
  79. CONTEXT MAPPING 03.09.2020 //// Seite 19 WPS – Workplace Solutions

    CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING 03.09.2020 //// Seite 20 WPS – Workplace Solutions PUBLISHED LANGUAGE ▪ A well-documented language for exchanging information. ▪ Can be defined in ▪ XML schema ▪ JSON scheme ▪ Protobuf ▪ etc. ▪ An open host service often "speaks" a PL. ▪ Examples: ▪ SEPA-XML for transfers and mandates ▪ BIPRO for insurance ▪ HL7 for healthcare ▪ WMS for map data Foto: Merker Berlin/Wikipedia/PD-self
  80. CONTEXT MAPPING 03.09.2020 //// Seite 21 WPS – Workplace Solutions

    CONTEXT MAPPING @ HAMBURG PORT CARTO- GRAPHY 03.09.2020 //// Seite 22 WPS – Workplace Solutions SHARED KERNEL ▪ Teams sometimes use similar models. ▪ In order to avoid duplication, these teams agree on a shared sub-model, the shared kernel. ▪ If this shared kernel is further developed, all teams involved will be included. ▪ The contexts of the teams remain separated from each other. Foto: Sander van der Wel/Wikipedia/CC BY-SA 2.0
  81. CONTEXT MAPPING 03.09.2020 //// Seite 23 WPS – Workplace Solutions

    INTEGRATION OF BOUNDED CONTEXTS ▪ RPC ▪ SOAP ▪ REST ▪ Messaging Foto: unclelkt/pixabay/CC0 03.09.2020 //// Seite 24 WPS – Workplace Solutions INTEGRATION @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING
  82. CONTEXT MAPPING 03.09.2020 //// Seite 25 WPS – Workplace Solutions

    CONTEXT MAPPING @ HAMBURG PORT TIDE FORECAST DEPTHS SOUNDING CARTO- GRAPHY CORE GEN. GEN. SUPP. 03.09.2020 //// Seite 26 WPS – Workplace Solutions OVERVIEW Required Communication Separate Ways Conformist Anti Corruption Layer Customer Supplier Open Host Service Shared Kernel Single Bounded Context
  83. CONTEXT MAPPING 03.09.2020 //// Seite 27 WPS – Workplace Solutions

    PRACTICE: Annotate the subdomains / bounded contexts in your map with those context mapping patterns? (OPTIONAL)
  84. UBIQUITOUS LANGUAGE WPS – Workplace Solutions #dddkonkret www.wps.de UBIQUITOUS LANGUAGE

    Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  85. UBIQUITOUS LANGUAGE “There are only two hard things in Computer

    Science: cache invalidation and naming things.” Phil Karlton 03.09.2020 //// Seite 4 WPS – Workplace Solutions TECHNO BABBLE Can I push to feature branch? Please deploy the container I create an interface for that Foto: Boboss74/deviantart Foto: Cronoxyd/Wikipedia/CC BY-SA 3.0 Foto: Microsoft/Wikipedia/PD ineligible
  86. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 5 WPS – Workplace Solutions

    DOMAIN LANGUAGE – MANEUVER PLANNING depth scale silhouette depth map marking overall length width excavator tolerance 03.09.2020 //// Seite 6 WPS – Workplace Solutions DOMAIN LANGUAGE - CHESS board king pieces player chess clock Foto: Fotograf Frank Hoppe/ Garry Kasparov/Wikipedia/PD-self Foto: Wikipedia/PD shape Foto: Thomas Depenbusch (Depi)/flickr/CC BY 2.0 Foto: Wikipedia/CC BY-SA 3.0 Foto: Wikipedia/CC BY-SA 3.0
  87. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 7 WPS – Workplace Solutions

    DOMAIN LANGUAGE – CHESS II draw zugzwang checkmate game move castling 03.09.2020 //// Seite 8 WPS – Workplace Solutions DOMAIN LANGUAGE – CHESS III to resign to draw to capture to hit the chess clock to castle
  88. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 9 WPS – Workplace Solutions

    FINDING THE RIGHT TERMS A B C D E F G • Categorize • Which criteria did you use? 03.09.2020 //// Seite 10 WPS – Workplace Solutions WHY DO WE NEED A UBIQUITOUS LANGUAGE? Domain Lingo Techno Babble ? Domain Expert Developer
  89. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 11 WPS – Workplace Solutions

    Fach- sprache Techno Babble Domain Lingo WHY DO WE NEED A UBIQUITOUS LANGUAGE? 03.09.2020 //// Seite 12 WPS – Workplace Solutions Domain Lingo Techno Babble WHY DO WE NEED A UBIQUITOUS LANGUAGE?
  90. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 13 WPS – Workplace Solutions

    Techno Babble Domain Lingo WHY DO WE NEED A UBIQUITOUS LANGUAGE? 03.09.2020 //// Seite 14 WPS – Workplace Solutions Domain Lingo Techno Babble UBIQUITOUS LANGUAGE
  91. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 15 WPS – Workplace Solutions

    Domain Lingo { Techno Babble } ? UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 16 WPS – Workplace Solutions Domain Lingo { Domain Lingo } UBIQUITOUS LANGUAGE public class Silhouette { public void moveBy(…) { /* ... */ } public void twistBy(…) { /* ... */ } /* ... */ }
  92. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 17 WPS – Workplace Solutions

    UBIQUITOUS LANGUAGE ▪ Domain experts do not understand terms relating to technical implementation. ▪ Domain experts speak the jargon of their domain, which in turn can be difficult for outsiders to understand. ➔ A common language is necessary! ▪ Which should it be? ▪ The developer’s? ▪ The domain expert’s? ▪ Something in between? ➔ Principle of DDD: "Use a language based on the domain model" Foto: The Tower of Babel/Pieter Brueghel the Elder/Wikipedia/CC-PD-Mark 03.09.2020 //// Seite 18 WPS – Workplace Solutions UBIQUITOUS LANGUAGE ▪ Use the ubiquitous language in .. ▪ communication ▪ orally ▪ written ▪ graphically ▪ code ▪ Basically everywhere ➔ That is why the language is called ubiquitous.
  93. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 19 WPS – Workplace Solutions

    Fach- sprache Techno Babble Domain Lingo HOW DO WE DEVELOP A UBIQUITOUS LANGUAGE? 03.09.2020 //// Seite 20 WPS – Workplace Solutions HOW DO WE DEVELOP A UBIQUITOUS LANGUAGE? ▪ Event Storming ▪ Domain Storytelling ▪ Interviews ▪ Plain text scenarios ▪ Glossaries
  94. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 21 WPS – Workplace Solutions

    DOMAIN STORYTELLING 03.09.2020 //// Seite 22 WPS – Workplace Solutions CONCRETE STORIES VS. ABSTRACT PROCESSES
  95. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 23 WPS – Workplace Solutions

    places NAVIGATOR CAPTAIN 7 SHIP‘S SILHOUETTE on SOUNDING SERVICE SOUNDING SHIP DEPTH 1 2 to 3 4 5 DEPTH MAP 8 SHIP‘S SILHOUETTE and finds 9 reports back to 6 ROUTE ROUTE DEPTH MAP DEPTH MAP RECORDED DEPTHS ROUTE CONTOUR LINE 03.09.2020 //// Seite 24 WPS – Workplace Solutions PRACTICE: DOMAIN STORYTELLING IN PLENARY ▪ Buying popcorn and beverages Foto: Derks24/pixabay/CC0
  96. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 25 WPS – Workplace Solutions

    SINGLE SENTENCE RULE… »The sounding service sends the completed depth map to the navigator.« SOUNDING SERVICE NAVIGATOR SENDS COMPLETED DEPTH MAP TO 03.09.2020 //// Seite 26 WPS – Workplace Solutions Actor Work Object Activity Note IMAGE TABLET
  97. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 27 WPS – Workplace Solutions

    Person Group IT System IMAGE TABLET - ACTORS 03.09.2020 //// Seite 28 WPS – Workplace Solutions IMAGE TABLET - WORK OBJECTS SOUNDS COMPILES DEPTH MAP DEPTH
  98. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 29 WPS – Workplace Solutions

    IMAGE TABLET - MEDIA ROUTE COMPLETED DEPTH MAP REQUESTS SENDS 03.09.2020 //// Seite 30 WPS – Workplace Solutions Actor Work Object Activity Note IMAGE TABLET - NO IF / SWITCH / OR / …
  99. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 31 WPS – Workplace Solutions

    ACTORS: UNIQUE / WORK OBJECTS: MULTIPLE 4 3 DEPTH MAP COMPLETED DEPTH MAP SOUNDING SERVICE Draw here Leave some empty space there → Annotations, variations, and purpose Preconditions, assumptions, and triggers Name of the Domain Story
  100. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 33 WPS – Workplace Solutions

    "Because sometimes three good examples are better for understanding the requirements than a bad abstraction. “ Peter Hruschka in Busines Analysis und Requirements Engineering, S.102, Hanser, 2014 03.09.2020 //// Seite 34 WPS – Workplace Solutions COLLABORATIVE VS MODERATED
  101. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 35 WPS – Workplace Solutions

    TOOLS – ANALOGOUS 03.09.2020 //// Seite 36 WPS – Workplace Solutions TOOLS – DIGITAL PowerPoint
  102. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 37 WPS – Workplace Solutions

    TOOLS – DOMAIN STORY MODELER https://www.wps.de/modeler/ • www.wps.de/modeler/ • github.com/WPS/domain-story-modeler 03.09.2020 //// Seite 39 WPS – Workplace Solutions http://domainstorytelling.org Twitter: @hofstef
  103. UBIQUITOUS LANGUAGE 15$ online: leanpub.com/domainstorytelling Free (but in German) Introduction

    including everything you need to know Short Overview 15$ online: leanpub.com/domainstorytelling Free (but in German) Introduction including everything you need to know Short Overview
  104. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 42 WPS – Workplace Solutions

    We recommend: ▪ Talk, talk, talk ▪ Collaborative Modeling: ▪ Event storming ▪ Domain storytelling ▪ Interviews & scenarios ▪ Glossaries ... DEVELOPING THE UBIQUITOUS LANGUAGE Fach- sprache Domain Lingo 03.09.2020 //// Seite 43 WPS – Workplace Solutions UML, BPMN & Co should be treated with caution: ▪ By software developers for software developers ▪ Conditionally suitable for workshops → risk of imposing an unwanted IT view on the customer ▪ Focus on documentation rather than communication DIE UBIQUITOUS LANGUAGE ENTWICKELN Domain Lingo Techno Babble ?
  105. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 44 WPS – Workplace Solutions

    GLOSSARY ▪ For core concepts (because a lot of work) ▪ existing terms ▪ reconstructed terms ▪ new terms ▪ More important at the beginning of the project and for new employees. ▪ Often a disposable product (no longer maintained). ▪ A dictionary does not replace a language course! Foto: George Eastman Museum/Wikipedia 03.09.2020 //// Seite 46 WPS – Workplace Solutions ▪ A team speaks its own language → Family language, dialect ▪ The same terms can have (slightly) different meanings. ▪ Language and model are closely linked. EVERY BOUNDED CONTEXT HAS ITS OWN UBIQUITOUS LANGUAGE MARKING DEPTHS MAP DEPTH DEPTHS SOUNDING SOUNDING SHIP DEPTH
  106. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 47 WPS – Workplace Solutions

    EVERY BOUNDED CONTEXT HAS ITS OWN GLOSSARY DEPTH MEASURED BY ECHO SOUNDER BELOW SEA LEVEL DEPTHS SOUNDING DEPTH DEPTH AT A SPECIFIC GEO POSITION DEPENDING ON EBB AND FLOW TIDE MANEUVER PLANNING MEASURED DEPTH Integer value in centimeters based on sea level You may also want to introduce a „traditional“ data dictionary as a „glossary“ of the published language 03.09.2020 //// Seite 48 WPS – Workplace Solutions LANGUAGE DOES NOT JUST APPEAR ▪ It takes weeks to months ... ▪ of hard work ▪ and sharp focus ▪ ... to reveal the key concepts. ▪ The first words of a ubiquitous language usually come straight from the domain. ▪ During development, new terms will be defined and added.
  107. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 49 WPS – Workplace Solutions

    DOMAIN LANGUAGE board king pieces player chess clock Foto: Fotograf Frank Hoppe/ Garry Kasparov/Wikipedia/PD-self Foto: Wikipedia/CC BY-SA 3.0 Foto: Wikipedia/PD shape Foto: Wikipedia/CC BY-SA 3.0 Foto: Thomas Depenbusch (Depi)/flickr/CC BY 2.0 03.09.2020 //// Seite 50 WPS – Workplace Solutions UBIQUITOUS LANGUAGE board pieces player Foto: Fotograf Frank Hoppe/ Garry Kasparov/Wikipedia/PD-self Foto: Wikipedia/PD shape Foto: Wikipedia/CC BY-SA 3.0
  108. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 51 WPS – Workplace Solutions

    UBIQUITOUS LANGUAGE – ITERATION 2 pieces player computer player board Foto: Fotograf Frank Hoppe/ Garry Kasparov/Wikipedia/PD-self Foto: Wikipedia/PD shape Foto: Wikipedia/CC BY-SA 3.0 Foto: Jim Gardner/Wikipedia/CC BY 2.0 03.09.2020 //// Seite 52 WPS – Workplace Solutions LANGUAGES ARE ALIVE ▪ Experiment with alternative expressions. ▪ The model and language continue to evolve. ▪ Then refactor the code ▪ Name classes, methods, modules ▪ Correspond to the new model ▪ A language wants to be spoken: ▪ Eliminate ambiguity through continuous communication. Foto: Tkgd2007/Wikipedia/CC BY-SA 3.0
  109. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 53 WPS – Workplace Solutions

    DISCUSS AND SOLVE PROBLEMS USING DOMAIN LANGUAGE When developers face technical problems ... ... the developers can try to solve those on their own, considering them as mere technical issues, ... or they MAY find a simple and appropriate workaround with the help of the domain experts. To achieve this, we need to describe the technical problem from a domain perspective using the ubiquitous language. Bild: pinterest.com 03.09.2020 //// Seite 54 WPS – Workplace Solutions EXAMPLE: SOLVING TECHNICAL PROBLEMS USING DOMAIN LANGUAGE Developers among themselves: "How do we build housekeeping of the ship silhouette table in the Oracle DB?" "No idea, let's ask the navigator." Developer to Navigator: "How long do we have to keep those silhouettes of the ships?“ Navigator: “You don’t have to any more. It used to be helpful when we still had to tinker those out of cardboard. Now with the software it's so easy to just create a new silhouette. It’s okay that way. “ Developer at his computer: "DROP TABLE ship silhouettes;"
  110. UBIQUITOUS LANGUAGE 03.09.2020 //// Seite 55 WPS – Workplace Solutions

    PRACTICE: EXTRACT UBIQUITOUS LANGUAGES ▪ Write a glossary for a term that is used in at least 2 subdomains. ▪ One card / stickie per term / subdomain ▪ brief definition / description (1 – 2 sentences) Foto: Derks24/pixabay/CC0
  111. DEVELOPING THE DOMAIN MODEL WPS – Workplace Solutions #dddkonkret www.wps.de

    DEVELOPING THE DOMAIN MODEL Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  112. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 3 WPS –

    Workplace Solutions ARCHITECTURE WITHIN A BOUNDED CONTEXT TIDE FORECAST DEPTHS SOUNDING 03.09.2020 //// Seite 4 WPS – Workplace Solutions ARCHITECTURE WITHIN A BOUNDED CONTEXT MANEUVER- PLANNING User Interface Domain Infrastructure Application
  113. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 5 WPS –

    Workplace Solutions DOMAIN-DRIVEN DESIGN – LAYER ARCHITECTURE ▪ User interface layer ▪ Receives input and user commands and presents information. ▪ Application layer (Fowler: Service Layer) ▪ Describes and coordinates application processes. ▪ Domain layer ▪ Represents the business domain logic. ▪ Infrastructure layer ▪ Provides technical services such as persistence or communication with other systems. User Interface Domain Infrastructure Application 03.09.2020 //// Seite 6 WPS – Workplace Solutions ARCHITECTURE OF DOMAIN LAYER? User Interface Domain Infrastructure Application MANEUVER- PLANNING
  114. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 7 WPS –

    Workplace Solutions FOWLER: DOMAIN LOGIC PATTERNS ▪ Transaction Script ▪ Table Module ▪ Domain Model ▪ (Anemic Domain Model) ▪ (Polluted Domain Model) Foto: Autor Webysther Nunes/Martin Fowler/Wikipedia/CC-BY-SA-4.0 03.09.2020 //// Seite 8 WPS – Workplace Solutions TRANSACTION SCRIPT ▪ Organizes the business logic into individual procedures. ▪ Each procedure covers a request from the presentation layer. ▪ Transaction brackets correspond directly to procedures. ▪ Communication directly or only via a slim adapter with database. ▪ Suitable for simple problems. calculateZoomLevel( depthMapId: long, zoom: byte ): byte[][] Button UI- + domain logic persistent domain data
  115. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 9 WPS –

    Workplace Solutions TABLE MODULE ▪ Business logic implemented in one class per database table. ▪ Algorithms work directly on result sets! Depth Maps calculateZoomLevel( depthMapId, zoom ): byte[][] getDepthMap( depthMapId ) : ResultSet domain logic persistent domain data 03.09.2020 //// Seite 10 WPS – Workplace Solutions DOMAIN MODEL ▪ Typical way of object-oriented modeling. ▪ POJOs / POCOs / POPOs ▪ Design independent of database. ▪ OR mapping is necessary. ▪ Use of concepts such as encapsulation, locality and delegation. DepthMap calculateZoomLevel( scale: Scale ): ZoomLevel ZoomLevel persistency Scale domain logic + data
  116. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 11 WPS –

    Workplace Solutions ▪ Entities named as per domain ▪ domain-specific behavior is missing ▪ getters and setters only ➔ Java beans ▪ "Crippled" entities (just data structures) ▪ Domain logic pulled up to service layer. ANEMIC DOMAIN MODEL Foto: Vampire/Wikipedia/FAL DepthMapService calculateZoomLevel( DepthMap ) DepthMap getDepths() setDepths() 03.09.2020 //// Seite 12 WPS – Workplace Solutions ▪ Domain Model ▪ Polluted by technology-specific code ▪ e. g. JPA annotations POLLUTED DOMAIN MODEL
  117. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 13 WPS –

    Workplace Solutions DOMAIN LOGIC + DATA: »WHAT BELONGS TOGETHER GROWS TOGETHER« FRONTEND BACKEND DB Transaction Script Table Module Domain Model FRONTEND BACKEND DB FRONTEND BACKEND DB domain logic + data Persistency UI- + domain logic persistent domain data persistent domain data domain logic UI logic UI Logic UI- + domain logic UI- + domain logic “So that you can live in peace tomorrow” 03.09.2020 //// Seite 14 WPS – Workplace Solutions MARTIN FOWLER ON DDD “Eric Evans is currently writing a book on building Domain Models. As I write this I’ve seen only an early manuscript, but it looks very promising.” Foto: Autor Webysther Nunes/Martin Fowler/Wikipedia/CC-BY-SA-4.0
  118. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 15 WPS –

    Workplace Solutions FOWLER: WANN MODELLIERT MAN EINE FACHDOMÄNE? Development effort Complexity of domain logic Table Module Transaction Skript Anemic DM Polluted DM 03.09.2020 //// Seite 16 WPS – Workplace Solutions EACH BOUNDED CONTEXT HAS ITS INDIVIDUAL ARCHITECTURE MANEUVER- PLANNING DEPTHS SOUNDING Transaction Script Domain Model
  119. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 17 WPS –

    Workplace Solutions LAYER ARCHITECTURE – CRITIQUE User Interface Domain Infrastructure Application MANEUVER- PLANNING ▪ Domain layer is linked to the database layer ▪ Technology “bubbles up” into domain layer ▪ No clean separation of domain & technology Alistair Cockburn Foto: Fotograf Dennis Hamilton/Alistair Cockburn/flickr/CC BY 2.0 03.09.2020 //// Seite 18 WPS – Workplace Solutions FROM LAYERS TOWARDS HEXAGONS ▪ The UI layer and the infrastructure layer are both things that make the domain logic available to the outside world. ▪ The hexagonal architecture therefore placed UI and infrastructure on the same “layer” ▪ Outside vs inside instead of above vs below ▪ A hexagon offers ports (the edges) ▪ Adapters are placed upon the ports http://alistair.cockburn.us/Hexagonal+architecture DOMAIN Port Port Adapter Adapter
  120. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 19 WPS –

    Workplace Solutions CLEAN ARCHITECTURE Robert C. Martin ”Uncle Bob“ 03.09.2020 //// Seite 20 WPS – Workplace Solutions Dependency Inversion Principle (DiP) a. „High-level modules should not depend on low-level modules. Both should depend on abstractions (e.g. interfaces). b. Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions.“ Robert C. Martin ”Uncle Bob“
  121. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 21 WPS –

    Workplace Solutions THE DOMAIN KERNEL ▪ DDD IDEA: SEPARATE TECHNICAL AND DOMAIN ARCHITECTURE! ▪ This can be better expressed by hexagons: The domain kernel is the very core! ▪ The domain kernel can be viewed as a technology-independent “domain framework” that provides a complete implementation of the domain logic. Domain logic + terms Port Port Adapter Adapter DOMAIN KERNEL 03.09.2020 //// Seite 22 WPS – Workplace Solutions BOUNDED CONTEXT THE DOMAIN KERNEL WITHIN A BOUNDED CONTEXT Domain logic + terms Port Port Adapter Adapter DB UI
  122. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 23 WPS –

    Workplace Solutions THE DOMAIN KERNEL – THE CELL NUCLEUS CONTAINING THE „DOMAIN DNA“ Bild: https://philschatz.com/anatomy-book/resources/0312_Animal_Cell_and_Components.jpg
  123. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 25 WPS –

    Workplace Solutions THE BASIC IDEA OF OBJEKT ORIENTATION: A SOFTWARE-TECHNICAL MODEL BASED ON DOMAIN OBJECTS 03.09.2020 //// Seite 26 WPS – Workplace Solutions FROM SCENARIO TO DOMAIN MODEL A scenario shows us how we do work with domain objects
  124. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 27 WPS –

    Workplace Solutions BACK TO THE SCENARIO DEPTH ft« SOUNDED DEPTH COLORED »RED« 03.09.2020 //// Seite 28 WPS – Workplace Solutions DEPTH ft« SOUNDED DEPTH COLORED »RED« LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  125. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 29 WPS –

    Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS 03.09.2020 //// Seite 30 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS WHO does WHAT using WHICH THINGS, in order to get from the start event to the end event? … …
  126. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 31 WPS –

    Workplace Solutions EXCURSUS: ZOOMING IN / OUT IN DEPTH MAPS 03.09.2020 //// Seite 32 WPS – Workplace Solutions ZOOMING OUT REDUCES THE RESOLUTION OF DEPTHS
  127. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 33 WPS –

    Workplace Solutions Shallowest depth in this area: 11.2 m WE HAVE TO REPLACE ALL DEPTHS BY THE SHALLOWEST DEPTH (BECAUSE THE SHIP COULD RUN AGROUND THERE) 03.09.2020 //// Seite 34 WPS – Workplace Solutions 11.2 Shallowest depth in this area: 11.2 m IN ORDER TO CALCULATE A ZOOM LEVEL, WE REPEAT THIS FOR ALL AREAS OF THE DEPTH MAP
  128. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 35 WPS –

    Workplace Solutions AND GET A LOWER RESOLUTION PLAN, SO, WHEN ZOOMING OUT WE CAN STILL SEE ALL RELEVANT DEPTHS 03.09.2020 //// Seite 36 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  129. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 37 WPS –

    Workplace Solutions COMMAND An ACTION TO BE TAKEN in order to reach the next event. 03.09.2020 //// Seite 38 WPS – Workplace Solutions SET THE SCALE FOR THE ZOOM LEVEL BLUE STICKIE In IMPERATIVE COMMAND
  130. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 39 WPS –

    Workplace Solutions timeline LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS 03.09.2020 //// Seite 40 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  131. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 41 WPS –

    Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS 03.09.2020 //// Seite 42 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  132. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 43 WPS –

    Workplace Solutions ACTORS OF A SCENARIO ACTOR 03.09.2020 //// Seite 44 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  133. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 45 WPS –

    Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS 03.09.2020 //// Seite 46 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  134. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 47 WPS –

    Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS ZOOM LEVEL YELLOW STICKIE NOUN Domain Term 03.09.2020 //// Seite 48 WPS – Workplace Solutions LET'S BUILD SOFTWARE FOR ZOOMING IN / OUT IN DEPTH MAPS
  135. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 49 WPS –

    Workplace Solutions TACTICAL EVENT STORMING PRACTICE: TACTICAL EVENT STORMING OF A SUBDOMAIN
  136. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 51 WPS –

    Workplace Solutions SO, WHAT‘S NEXT? 03.09.2020 //// Seite 52 WPS – Workplace Solutions THE BASIC IDEA OF OBJEKT ORIENTATION: A SOFTWARE- TECHNICAL MODEL BASED ON DOMAIN OBJECTS
  137. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 53 WPS –

    Workplace Solutions LENGTH ... are modeled by their behavior ... ... and implemented in domain classes. Length Position public class Silhouette { void moveBy(Length len) { assert len != null; … position.add(len)); } } Domain objects… MOVES LENGTH SILHOUETTE SILHOUETTE MOVED MOVE BY SILHOUETTE NAVIGATOR 03.09.2020 //// Seite 54 WPS – Workplace Solutions LENGTH FROM EVENT STORMING TO DOMAIN MODEL Silhouette SILHOUETTE SILHOUETTE MOVED MOVE BY LENGTH moveBy(:Length) Length
  138. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 55 WPS –

    Workplace Solutions FROM DOMAIN STORY TO DOMAIN MODEL Silhouette MOVES SILHOUETTE NAVIGATOR LENGTH Length moveBy(:Length) BY 03.09.2020 //// Seite 61 WPS – Workplace Solutions Label - add keyword - compare with other label Keyword Tab - tag - insert document by date tag document date (Responsibility) - remove document - insert document - label - find document by keyword - create tabs (Collaborator) Document Label Date Tab Folder (Class) CRC cards
  139. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 62 WPS –

    Workplace Solutions Ward Cunningham CRC CARDS ▪ OOPSLA '89: A laboratory for teaching object oriented thinking Kent Beck Foto: Teconología/Wikipedia/CC BY-SA 4.0 Foto: Carrigg Photography/Wikipedia/CC BY-SA 3.0 03.09.2020 //// Seite 63 WPS – Workplace Solutions (Responsibility) - remove document - insert document - label - find document by keyword - create tabs (Collaborator) Document Label Date Tab Folder (Class)
  140. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 64 WPS –

    Workplace Solutions (Responsibility) - remove document - insert document - label - find document by keyword - create tabs (Collaborator) Document Label Date Tab Folder (Class) ENTITY COMMAND COLLABO -RATOR BASIC IDEA: Reuse DOMAIN TERM and COMMAND stickies from event storming!!! 03.09.2020 //// Seite 65 WPS – Workplace Solutions STICKIES INSTEAD OF CRC CARDS – STEP 1 DOCUMENT LABEL DATE TAB FOLDER label find document by keyword create tab tag add document by date KEYWORD get keyword compare with other label insert document remove document • Take domain terms (yellow) and commands (blue) from event storming. • Assign a command to a domain term, if the command modifies or inspects the designated artifact.
  141. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 66 WPS –

    Workplace Solutions STICKIES INSTEAD OF CRC CARDS – STEP 2 • Add collaborators (use pink or any other color). DOCUMENT LABEL DATE TAB FOLDER label find document by keyword create tab tag add document by date KEYWORD get keyword compare with other label insert document remove document DOCUMENT LABEL DATE TAB KEYWORD LABEL DOCUMENT 03.09.2020 //// Seite 67 WPS – Workplace Solutions DOCUMENT LABEL DATE TAB FOLDER label find document by keyword create tab tag add document by date KEYWORD get keyword compare with other label insert document remove document STICKIES INSTEAD OF CRC CARDS – STEP 3 – DONE! • Replace collaborators by arrows. → RESULT: An object-oriented class diagram!
  142. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 68 WPS –

    Workplace Solutions ... AND THIS IS HOW THE SAME MODEL WOULD LOOK AS A CLASS DIAGRAM: Folder ▪ createTab: Tab ▪ findByLabel(Label): Document ▪ label(Label) ▪ insert(Document) ▪ remove(Document) Label ▪ compareTo(Label) ▪ getKeyword: Keyword Keyword Tab ▪ addByDate(Document, Date) ▪ tag(Tag) Date Document 03.09.2020 //// Seite 69 WPS – Workplace Solutions ... AND THIS IS HOW THE SAME MODEL WOULD LOOK AS A CLASS DIAGRAM: Folder ▪ createTab: Tab ▪ findByLabel(Label): Document ▪ label(Label) ▪ insert(Document) ▪ remove(Document) Label ▪ compareTo(Label) ▪ getKeyword: Keyword Keyword Tab ▪ addByDate(Document, Date) ▪ tag(Tag) Date Document
  143. DEVELOPING THE DOMAIN MODEL PRACTICE: ASSIGN COMMANDS TO DOMAIN TERMS

    AND CREATE A DOMAIN MODEL 03.09.2020 //// Seite 72 WPS – Workplace Solutions WE CODE RIGHT AWAY – STARTING POINT: EVENT STORMING SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT
  144. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 73 WPS –

    Workplace Solutions WE CODE RIGHT AWAY – EVENTS AS ACCEPTANCE CRITERIA SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT 03.09.2020 //// Seite 74 WPS – Workplace Solutions WE CODE RIGHT AWAY – TEST-DRIVEN! SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT
  145. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 75 WPS –

    Workplace Solutions WE CODE RIGHT AWAY – FROM PSEUDO CODE TO DOMAIN MODEL SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT 03.09.2020 //// Seite 76 WPS – Workplace Solutions WE CODE RIGHT AWAY – TEST-DRIVEN: MAKE IT RUN SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT
  146. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 77 WPS –

    Workplace Solutions WE CODE RIGHT AWAY – RESULT ▪We can create a complex and elaborate domain model based on just a single scenario. ▪By testing, we can make sure that this domain model fits the scenario completely and perfectly! ▪Any additional scenario gradually leads to an improved and more comprehensive domain model! ▪The more precise the scenarios, the better and more elaborate our domain model. SAALPLAN GEHOLT VORSCHLAG ANGE- NOMMEN PREIS BAR BEZAHLT 03.09.2020 //// Seite 78 WPS – Workplace Solutions TYPES OF OPERATIONS IN OBJECT ORIENTED INTERFACES Operations describe the way in which objects are worked with in various scenarios. We differentiate: ▪ What information is "read" from the objects? ▪ What changes are made to the objects and what actions are triggered (except destructive actions or actions transforming the object into another type of object)? →CQS principle of Bertrand Meyer Ship‘s Silhouette • move by • twist • position? • overall length? • width? ...
  147. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 79 WPS –

    Workplace Solutions ▪ An operation should either ▪ modify the object‘s state ➔ Command ▪ read the object‘s state ➔ Query ▪ But never both! COMMAND QUERY SEPARATION 03.09.2020 //// Seite 80 WPS – Workplace Solutions ▪Reading the object‘s state should never have any side effects! ▪Anything else would be a risky game. COMMAND QUERY SEPARATION Foto: Urheber Fuchsias/Bertrand Meyer/Wikipedia/CC BY-SA 4.0
  148. DEVELOPING THE DOMAIN MODEL 03.09.2020 //// Seite 81 WPS –

    Workplace Solutions INTERFACES OF DOMAIN CLASSES The concept of modeling domain classes: ▪ Choose domain-specific terms (→ nouns) ▪ Describe their operations (→ verbs) and additional domain objects required. DO NOT JUST MODEL DATA! Ship‘s Silhouette • move by • twist • position? • overall length? • width? ... 03.09.2020 //// Seite 82 WPS – Workplace Solutions UBIQUITOUS LANGUAGE AND DOMAIN MODEL DepthsMap calculateZoomLevel Marking Depth ZoomLevel MARKING DEPTHS MAP DEPTH ZOOM- LEVEL WE ARE IN THE MIDDLE OF AN AGILE PROCESS OF LANGUAGE AND MODEL DEVELOPMENT
  149. TACTICAL DESIGN WPS – Workplace Solutions #dddkonkret www.wps.de TACTICAL DESIGN

    Domain-Driven Design concrete 03.09.2020 //// Seite 2 WPS – Workplace Solutions
  150. TACTICAL DESIGN 03.09.2020 //// Seite 3 WPS – Workplace Solutions

    Entities Value Objects Aggregates Services Factories Repositories 03.09.2020 //// Seite 4 WPS – Workplace Solutions DOMAIN TERMS – WHAT IS STRIKING? insurance policy vacation request building activity purchase contract order zip code GPS coordinate IBAN container number IATA code
  151. TACTICAL DESIGN 03.09.2020 //// Seite 5 WPS – Workplace Solutions

    ENTITIES ▪ Objects of a domain that the user works with. ▪ The results of the work are reflected by their state! ▪ Can be composed of other entities. ▪ Have an (immutable) identity. ▪ Maintain their own consistency and integrity! ▪ Have a clearly defined life cycle. ▪ Have a (mostly mutable) state. ▪ Describe their state by value objects. ▪ Synonyms: Business Object / Domain Object / Work Material ▪ NOT TO BE confused with the term "ENTITY" from Entity- Relationship-Model! Foto: Bundesrepublik Deutschland/Wikipedia/PD Germany Foto: Kaz/pixabay/CC0 Foto: Thomas G./Wikipedia/CC BY-SA 3.0 Foto: OpenClipart-Vectors/pixabay/CC0
  152. TACTICAL DESIGN 03.09.2020 //// Seite 7 WPS – Workplace Solutions

    ENTITIES <<Entity>> DepthMap depthMapId mark(Marking) 03.09.2020 //// Seite 8 WPS – Workplace Solutions VALUE OBJECTS ▪ Value objects are symbols for values of a certain type in the domain. ▪ Symbolize the same value if they are equal. ▪ They are not edited by the user and cannot be modified. ▪ Can be calculated (from other value objects), if necessary. ▪ Can consist of other value objects, but never of entities! ValueObject 2,5 ValueObject ValueObject ValueObject ValueObject zwei- einhalb
  153. TACTICAL DESIGN Depth Diameter Position 03.09.2020 //// Seite 10 WPS

    – Workplace Solutions VALUE OBJECTS <<Value Object>> Depth centimeters : int equals()
  154. TACTICAL DESIGN 03.09.2020 //// Seite 11 WPS – Workplace Solutions

    VALUE OBJECTS - MORE ▪ Whole Value ▪ Methods may not change the state, but may return "new" value objects ▪ A lot of boilerplate code is required in Java → Project Lombok ▪ Operator overloading ▪ The same term can designate an entity in one bounded context and a value object in the other. 03.09.2020 //// Seite 12 WPS – Workplace Solutions PRACTICE: IDENTIFY THE BUILDING BLOCK TYPES – PART 1 ▪ Review your domain model: ▪ What is an entity? What is a value object? ▪ What else do we need?
  155. TACTICAL DESIGN 03.09.2020 //// Seite 13 WPS – Workplace Solutions

    AGGREGATES ▪ Aggregates are entities that are relevant in themselves (and not just as part of another entity). ▪ Protect the consistency and integrity of their inner entities. ▪ They don't necessarily have to hide them to do this! ▪ Always have a designated entity as an entry point (root). ▪ Usually stored. ▪ As a whole! ▪ Not necessarily in a relational way! Root Entity VO VO VO Aggregate 03.09.2020 //// Seite 14 WPS – Workplace Solutions AGGREGATES ▪ Actually, the value objects are outside as they are immutable and may be reused anywhere. Root Entity VO VO VO Some other object Aggregate
  156. TACTICAL DESIGN 03.09.2020 //// Seite 15 WPS – Workplace Solutions

    AGGREGATES ▪ An aggregate can consist of many entities. Root Entity Entity Entity Entity Entity VO VO VO VO VO VO VO VO VO VO VO Aggregate
  157. TACTICAL DESIGN 03.09.2020 //// Seite 17 WPS – Workplace Solutions

    Aggregate <<Aggregate Root>> DepthMap <<Entity>> Marking <<Value Object>> Depth 03.09.2020 //// Seite 18 WPS – Workplace Solutions REPOSITORIES ▪ Are the access points to the aggregates! ▪ Encapsulate the technical details of the technical infrastructure layer ... ▪ ... and map external data to entities and value objects. ▪ Store aggregates (e. g. in databases). Repository
  158. TACTICAL DESIGN 03.09.2020 //// Seite 19 WPS – Workplace Solutions

    REPOSITORY @ HAMBURG PORT: THE DEPTH MAP CABINET 03.09.2020 //// Seite 20 WPS – Workplace Solutions REPOSITORY: TWO PART IMPLEMENTATION <<Repository Interface>> DepthMapCabinet getDepthMap(Area, Scale) : DepthMap putBack(DepthMap) <<Repository Implementation>> MySQLDepthMapCabinet
  159. TACTICAL DESIGN 03.09.2020 //// Seite 21 WPS – Workplace Solutions

    PRACTICE: IDENTIFY THE BUILDING BLOCK TYPES – PART 2 ▪ Which entities are in fact aggregates? ▪ Which repositories do we need? 03.09.2020 //// Seite 22 WPS – Workplace Solutions Service (DOMAIN) SERVICES ▪ (Domain) services represent fixed procedures or processes of the domain. ▪ Unless those can be executed by aggregates / entities. ▪ Are stateless! ▪ Parameters and results of their operationens are aggregates and value objects.
  160. TACTICAL DESIGN 03.09.2020 //// Seite 23 WPS – Workplace Solutions

    ZoomService 03.09.2020 //// Seite 24 WPS – Workplace Solutions FACTORIES ▪ Factories create aggregates (and sometimes value objects). ▪ However, aggregates and value objects do not have to be created by factories. ▪ new DepthMap() is ok! Factory
  161. TACTICAL DESIGN 03.09.2020 //// Seite 25 WPS – Workplace Solutions

    ▪ Orchestrate use cases. ▪ Provide technical access to the domain layer. ▪ Leverage domain logic from the domain layer, but DO NOT implement any domain logic themselves! ▪ Are located within the application layer (ABOVE the domain layer)! ▪ Provide an API / form a facade. ▪ Application / technology-driven ▪ Transactions ▪ Security ▪ Backend for frontend APPLICATION SERVICE Foto: Fotograf Andreas Praefcke/Wikipedia/PD-self 03.09.2020 //// Seite 26 WPS – Workplace Solutions Domain ELEMENTS OF THE DOMAIN KERNEL User Interface Infrastructure Application Domain Service Factory Aggregate Value Object Repository Root Entity Entity Entity Application Service
  162. TACTICAL DESIGN 03.09.2020 //// Seite 27 WPS – Workplace Solutions

    Domain ELEMENTS OF THE DOMAIN KERNEL User Interface Infrastructure Application Domain Service Factory Aggregate Value Object Root Entity Entity Entity Application Service Repository Interface 03.09.2020 //// Seite 28 WPS – Workplace Solutions Domain Kernel RepoInMemory Repo RepoTest • Repo: Interface of the repository → „syntax“ • RepoTest: Acceptance tests / unit test of the repository → „semantics“ • RepoInMemory: Reference implementation of the repository • Transient. • Can be used as a (comprehensively tested) “mock object” in tests. • Can rapidly be implemented during a mob-programming session. Aggregate EVEN MORE ACCURATE
  163. TACTICAL DESIGN 03.09.2020 //// Seite 29 WPS – Workplace Solutions

    Adapter 3 Adapter 2 Adapter 1 Domain Kernel OracleDB xxx .csv RepoInMemory RepoCsv RepoRelational RepoRest Repo RepoTest 3rd party (REST-API) STRICT SEPARATION OF TECHNICAL & DOMAIN CODE 03.09.2020 //// Seite 30 WPS – Workplace Solutions THE DOMAIN KERNEL IMPLEMENTS ALL DOMAIN FEATURES OF A BOUNDED CONTEXT DOMAIN KERNEL I MASTER EVERYTHING!
  164. TACTICAL DESIGN 03.09.2020 //// Seite 31 WPS – Workplace Solutions

    THE »CORE ELEMENTS« Services Value Objects Entities stateless (mostly) mutable state immutable state »Micro layering« (not strict!) 03.09.2020 //// Seite 32 WPS – Workplace Solutions ELEMENTS OF THE DOMAIN KERNEL Services Factories Aggregates Repositories »Micro layering« (not strict!) Domain objects Support the life cycle of the domain objects Entities Value Objects
  165. TACTICAL DESIGN 03.09.2020 //// Seite 33 WPS – Workplace Solutions

    Domain event DOMAIN EVENTS ▪ Signalize events that are relevant from a domain perspective. ▪ Signalize events that have happened. ▪ NOT those that are supposed to happen! ▪ Some bounded contexts react on these technical events, others do not. ▪ Are used for communication between bounded contexts and ... ▪ ... promote their decoupling, ▪ ... facilitate asynchronous processes. ▪ Often communicated by messaging. 03.09.2020 //// Seite 34 WPS – Workplace Solutions MANEUVER -PLANNING DEPTH MAP COMPLETED DOMAIN EVENTS @ HAMBURG PORT
  166. TACTICAL DESIGN 03.09.2020 //// Seite 35 WPS – Workplace Solutions

    DOMAIN EVENTS – EXAMPLES InvoiceIssued TransferDone BookSold AccountOpened 03.09.2020 //// Seite 36 WPS – Workplace Solutions PRACTICE: IDENTIFY THE BUILDING BLOCK TYPES – PART 3 ▪ Which domain services / factories / application services do you still need? ▪ Which domain events?