Slide 1

Slide 1 text

Starring With Directed by In the role of Also Starring

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

H3NN1NG

Slide 6

Slide 6 text

Schw3ntn3r

Slide 7

Slide 7 text

@hschwentner

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Foto: Steindy/Wikipedia

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

@hschwentner Do I get a car for this?

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

CUSTOMER TELLS WISH FOR 1 SALESPERSON SIGNS TO GIVES FOR CONTRACT 3 RISIK MANAGER CONTRACT PASSES ON TO 4 CONTRACT VOTES CHECKS CALCULATES 5 6 7 CALCU- LATES TO 8 2 CAR CREDIT RATING INSTALLMENT CAR RESALE VALUE CONTRACT

Slide 21

Slide 21 text

@hschwentner How do we design a program for that?

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

@hschwentner #dddesign

Slide 24

Slide 24 text

@hschwentner Was ist das für 1 Design?

Slide 25

Slide 25 text

@hschwentner Vong Domain her

Slide 26

Slide 26 text

-DRIVEN DESIGN

Slide 27

Slide 27 text

Software Domain

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

CUSTOMER SIGNS CONTRACT 3 RISK MANAGER CONTRACT VOTES 7 <> LeasingContract sign() vote()

Slide 32

Slide 32 text

<> LeasingContract sign() vote()

Slide 33

Slide 33 text

Object orientation

Slide 34

Slide 34 text

<> LeasingContract sign() vote() extend() terminate() sell_to_refinance() ...

Slide 35

Slide 35 text

@hschwentner The One Big Model

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

@hschwentner Reality: Not one big model But several mixed models

Slide 39

Slide 39 text

BBOM Foto: Benutzer:Summi/Wikipedia/CC-BY-SA-3.0-migrated

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

@hschwentner “Whoever uses a canonical model has lost control over his life.” – Karl Lagerfeld

Slide 43

Slide 43 text

@hschwentner »Wer ein unternehmensweites Modell einsetzt, hat die Kontrolle über sein Leben verloren« – Karl Lagerfeld

Slide 44

Slide 44 text

@hschwentner Why is that?

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

@hschwentner Too Big to be understood as a whole

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

@hschwentner Model?

Slide 51

Slide 51 text

A tool to understand the world

Slide 52

Slide 52 text

?

Slide 53

Slide 53 text

?

Slide 54

Slide 54 text

?

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

CUSTOMER TELLS WISH FOR 1 SALES-PERSON SIGNS TO GIVES FOR CONTRACT 3 RISIK MANAGER CONTRACT PASSES ON TO 4 CONTRACT VOTES CHECKS CALCULATES 5 6 7 CALCU- LATES TO 8 2 CAR CREDIT RATING INSTALLMENT CAR RESALE VALUE CONTRACT SALES RISK MANAGMENT

Slide 60

Slide 60 text

<> LeasingContract sign() vote() ✘

Slide 61

Slide 61 text

<> LeasingContract sign() <> LeasingContract vote()

Slide 62

Slide 62 text

<> LeasingContract sign() <> LeasingContract vote() SALES RISK MANAGEMENT

Slide 63

Slide 63 text

Bounded Context

Slide 64

Slide 64 text

<> LeasingContract sign() <> LeasingContract vote() SALES RISK MANAGEMENT

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

@hschwentner Clear Boundaries

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

@hschwentner Code Team Database

Slide 69

Slide 69 text

@hschwentner Strategic Design

Slide 70

Slide 70 text

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

Team Head Team Tail Team Body Team Legs

Slide 76

Slide 76 text

Team Emma Team Berta Team Erna Team Lisl

Slide 77

Slide 77 text

<> LeasingContract sign() <> LeasingContract vote()

Slide 78

Slide 78 text

@hschwentner Implementing Multiple Models

Slide 79

Slide 79 text

@hschwentner JVM: Packages Jigsaw-Modules

Slide 80

Slide 80 text

@hschwentner .NET: DLLs

Slide 81

Slide 81 text

@hschwentner PHP: Namespaces

Slide 82

Slide 82 text

@hschwentner JavaScript: Revealing Module Pattern TypeScript: Modules

Slide 83

Slide 83 text

@hschwentner Generally: Microservices Self-Contained Systems Verticals

Slide 84

Slide 84 text

@hschwentner Multiple Models in Java

Slide 85

Slide 85 text

@hschwentner How?

Slide 86

Slide 86 text

Packages

Slide 87

Slide 87 text

@hschwentner 1 bounded context = 1 package

Slide 88

Slide 88 text

package leasingninja.sales; class LeasingContract { /*...*/ } package leasingninja.riskmanagement; class LeasingContract { /*...*/ }

Slide 89

Slide 89 text

<> LeasingContract sign() <> LeasingContract vote() <> leasingninja.sales <> leasingninja.riskmanagement

Slide 90

Slide 90 text

Problems: * No real encapsulation * No nesting * only a logical group of classes

Slide 91

Slide 91 text

Only public and package private

Slide 92

Slide 92 text

But: all classes of a bounded context in one package -> already quite ok

Slide 93

Slide 93 text

@hschwentner Project Jigsaw

Slide 94

Slide 94 text

@hschwentner Real capsule

Slide 95

Slide 95 text

@hschwentner package leasingninja.sales.ui; package leasingninja.sales.domain; package leasingninja.sales.infrastructure;

Slide 96

Slide 96 text

@hschwentner package leasingninja.sales.ui; package leasingninja.sales.domain; package leasingninja.sales.infrastructure; package leasingninja.sales.api;

Slide 97

Slide 97 text

@hschwentner /* module-info.java */ module leasingninja.sales { exports leasingninja.sales.api; }

Slide 98

Slide 98 text

leasingninja.sales.api leasingninja.sales.* Interface Not accessible from outside

Slide 99

Slide 99 text

@hschwentner /* module-info.java */ module leasingninja.riskmanagement { requires leasingninja.sales; }

Slide 100

Slide 100 text

RISK MANAGE-MENT SALES

Slide 101

Slide 101 text

Rule: reverse domain names

Slide 102

Slide 102 text

@hschwentner /* module-info.java */ module de.wps.leasingninja.sales { exports de.wps.leasingninja.sales.api; }

Slide 103

Slide 103 text

@hschwentner /* module-info.java */ module de.wps.leasingninja.riskmanagement { requires de.wps.leasingninja.sales; }

Slide 104

Slide 104 text

@hschwentner Modular JAR

Slide 105

Slide 105 text

@hschwentner Maybe even better fitting: services mit uses/provides with

Slide 106

Slide 106 text

@hschwentner Multiple Models in .NET

Slide 107

Slide 107 text

@hschwentner How?

Slide 108

Slide 108 text

Assembly

Slide 109

Slide 109 text

@hschwentner 1 bounded context = 1 DLL

Slide 110

Slide 110 text

namespace Leasingninja.Sales { class LeasingContract { /*...*/ } } namespace Leasingninja.Riskmanagement; { class LeasingContract { /*...*/ } }

Slide 111

Slide 111 text

<> LeasingContract sign() <> LeasingContract vote() <> Leasingninja.Sales <> Leasingninja.Riskmanagement

Slide 112

Slide 112 text

@hschwentner Architecture inside a Bounded Context (DLL)

Slide 113

Slide 113 text

@hschwentner namespace Leasingninja.Sales.UI {} namespace Leasingninja.Sales.Application {} namespace Leasingninja.Sales.Domain {} namespace Leasingninja.Sales.Infrastructure {}

Slide 114

Slide 114 text

@hschwentner namespace Leasingninja.Sales.UI {} namespace Leasingninja.Sales.Application {} namespace Leasingninja.Sales.Domain {} namespace Leasingninja.Sales.Infrastructure {} namespace Leasingninja.Sales {}

Slide 115

Slide 115 text

@hschwentner namespace Leasingninja.Sales.Domain { [Entity] internal class LeasingContract { /*...*/ } } namespace Leasingninja.Sales { [DomainEvent] public class ContractSigned { /*...*/ } }

Slide 116

Slide 116 text

Leasingninja.Sales Leasingninja.Sales.UI Leasingninja.Sales.Application Leasingninja.Sales.Domain Leasingninja.Sales.Infrastructure Interface Not accessible from outside

Slide 117

Slide 117 text

RISK MANAGE-MENT SALES

Slide 118

Slide 118 text

@hschwentner Multiple Models in PHP

Slide 119

Slide 119 text

@hschwentner How?

Slide 120

Slide 120 text

Namespace

Slide 121

Slide 121 text

@hschwentner 1 bounded context = 1 namespace

Slide 122

Slide 122 text

Slide 123

Slide 123 text

FQCN (Fully qualified class name = full namespace + class name)

Slide 124

Slide 124 text

<> LeasingContract sign() <> LeasingContract vote() <> Leasingninja.Sales <> Leasingninja.Riskmanagement

Slide 125

Slide 125 text

Problems: * No encapsulation * only a logical group of classes

Slide 126

Slide 126 text

But: all classes of a bounded context in one namespace -> better than nothing

Slide 127

Slide 127 text

@hschwentner Architecture inside a Bounded Context

Slide 128

Slide 128 text

@hschwentner namespace Leasingninja\Sales\UI; namespace Leasingninja\Sales\Application; namespace Leasingninja\Sales\Domain; namespace Leasingninja\Sales\Infrastructure;

Slide 129

Slide 129 text

@hschwentner namespace Leasingninja\Sales\UI; namespace Leasingninja\Sales\Application; namespace Leasingninja\Sales\Domain; namespace Leasingninja\Sales\Infrastructure; namespace Leasingninja\Sales;

Slide 130

Slide 130 text

Leasingninja.Sales Leasingninja.Sales.UI Leasingninja.Sales.Application Leasingninja.Sales.Domain Leasingninja.Sales.Infrastructure Interface (should) not be accessible from outside

Slide 131

Slide 131 text

Convention: Access only 1 dot 2 dot only in same BC

Slide 132

Slide 132 text

RISK MANAGE-MENT SALES

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

@hschwentner Multiple Models with Microservices

Slide 135

Slide 135 text

No content

Slide 136

Slide 136 text

No content

Slide 137

Slide 137 text

No content

Slide 138

Slide 138 text

Distributed System

Slide 139

Slide 139 text

Fallacies of distributed computing: The network is reliable. Latency is zero. Bandwidth is infinite. The network is secure. Topology doesn't change. There is one administrator. Transport cost is zero. The network is homogeneous.

Slide 140

Slide 140 text

Verticals Self-Contained Systems Microservices

Slide 141

Slide 141 text

No content

Slide 142

Slide 142 text

No content

Slide 143

Slide 143 text

Micro- service A Presentation Domain Infrastructure Application Micro- service B Direct Access to DB Micro- service C

Slide 144

Slide 144 text

Slide 145

Slide 145 text

No content

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

@hschwentner Independent Deployability

Slide 149

Slide 149 text

Team Emma Team Berta Team Erna Team Lisl

Slide 150

Slide 150 text

Team Emma Team Berta Team Erna Team Lisl

Slide 151

Slide 151 text

Team Emma Team Berta Team Erna Team Lisl

Slide 152

Slide 152 text

RISK MANAGE-MENT SALES

Slide 153

Slide 153 text

RISK MANAGE-MENT

Slide 154

Slide 154 text

RISK MANAGE-MENT SALES

Slide 155

Slide 155 text

@hschwentner Core Domain

Slide 156

Slide 156 text

Team Emma Team Berta Team Erna Team Lisl

Slide 157

Slide 157 text

Team Emma Team Berta Team Erna Team Lisl

Slide 158

Slide 158 text

No content

Slide 159

Slide 159 text

No content

Slide 160

Slide 160 text

RISK MANAGE-MENT SALES

Slide 161

Slide 161 text

No content

Slide 162

Slide 162 text

@hschwentner How to split the monolith

Slide 163

Slide 163 text

1) How should it be? 2) How is it? 3) How to move the “is” to the “ideal”? RISK MANAGE- MENT SALES

Slide 164

Slide 164 text

1) How should it be? 1) Collaborative Modelling 2) “ideal” context map 2) How is it? 1) Architecture Analysis 2) As-is context map 3) How to move the “is” to the “ideal”? 1) Extract a supporting domain to learn 2) Then extract core(s)

Slide 165

Slide 165 text

<> LeasingContract sign() vote() SALES RISK MANAGEMENT <> LeasingContract sign() vote() BIG BALL OF MUD <> LeasingContract sign() vote()

Slide 166

Slide 166 text

@hschwentner Always Microservices?

Slide 167

Slide 167 text

Simon Brown

Slide 168

Slide 168 text

Distributed Big Ball Of Mud Modulith Microservices Monolithic Big Ball Of Mud

Slide 169

Slide 169 text

No content

Slide 170

Slide 170 text

@hschwentner Consulting

Slide 171

Slide 171 text

@hschwentner Team organization

Slide 172

Slide 172 text

No content

Slide 173

Slide 173 text

No content

Slide 174

Slide 174 text

No content

Slide 175

Slide 175 text

“Organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations.” Melvin Conway

Slide 176

Slide 176 text

Melvin Conway (1967) “Organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations.”

Slide 177

Slide 177 text

“The organization of the software and the organization of the software team will be congruent.” Eric Raymond

Slide 178

Slide 178 text

“If you have four groups working on a compiler, you'll get a 4-pass compiler.” Eric Raymond

Slide 179

Slide 179 text

@hschwentner Conclusion

Slide 180

Slide 180 text

1. Model your domain 2. Split => several models (3. Distribute models)

Slide 181

Slide 181 text

Strategic Design must Microservices can

Slide 182

Slide 182 text

@hschwentner Further Reading

Slide 183

Slide 183 text

@hschwentner LeasingNinja.io

Slide 184

Slide 184 text

@hschwentner speakerdeck.com/hschwentner

Slide 185

Slide 185 text

Foto: H. Schwentner

Slide 186

Slide 186 text

Foto: H. Schwentner

Slide 187

Slide 187 text

Foto: Amazon

Slide 188

Slide 188 text

No content

Slide 189

Slide 189 text

No content

Slide 190

Slide 190 text

15$ online: leanpub.com/domainstorytelling Frag mich nach Deiner Kopie Einführung mit allem was man wissen muss Überblick Rabatt! https://leanpub.com/domainstorytelling/c/wjax2019

Slide 191

Slide 191 text

@hschwentner What now?

Slide 192

Slide 192 text

@hschwentner Consulting

Slide 193

Slide 193 text

No content

Slide 194

Slide 194 text

Workshop Domain-Driven Design concrete wps.de/ddd

Slide 195

Slide 195 text

@hschwentner Foto: Henning Schwentner

Slide 196

Slide 196 text

No content

Slide 197

Slide 197 text

No content

Slide 198

Slide 198 text

No content

Slide 199

Slide 199 text

@hschwentner FEEDBACK

Slide 200

Slide 200 text

No content

Slide 201

Slide 201 text

No content

Slide 202

Slide 202 text

No content

Slide 203

Slide 203 text

No content

Slide 204

Slide 204 text

No content

Slide 205

Slide 205 text

No content

Slide 206

Slide 206 text

Henning Schwentner @hschwentner [email protected] DDD DDD Slides: speakerdeck.com/hschwentner Book: leanpub.com/domainstorytelling