Slide 1

Slide 1 text

Strategic Domain Driven Design A n O v e r v i e w b y M i c h a e l P l ö d

Slide 2

Slide 2 text

2 My assuptions / prerequisites You have some knowledge about software architecture. Maybe even DDD. You don’t need to be an expert. I will talk about A quick overview about strategic Domain-driven Design. We could easily talk over a day on this topic ;-) I will NOT talk about Any advanced Domain-driven Design stuff. This talk is an overview, not a deep dive.

Slide 3

Slide 3 text

Get my DDD book cheaper Book Voucher: 7.99 instead of (min) 9.99 http://leanpub.com/ddd-by-example/c/speakerdeck

Slide 4

Slide 4 text

4 Speaker Michael Plöd Fellow at INNOQ Twitter: @bitboss

Slide 5

Slide 5 text

5 “A loosely coupled software architecture and org structure to match” is a key predictor of: •Continuous Delivery Performance •Ability to scale organization and increase performance linearly

Slide 6

Slide 6 text

6 Domain-driven Design is an holisitic approach towards Software Architecture which goes beyond technical aspects by addressing cultural and organizational aspects of a delivery organization as well.

Slide 7

Slide 7 text

How do we solve the Problem? What Problem do we want to solve?

Slide 8

Slide 8 text

8 In order to align the what and the how we need communication between the business and the IT

Slide 9

Slide 9 text

Business Domain Experts Developers Architects ? Software Engineering Domain Know-How

Slide 10

Slide 10 text

What could possibly go wrong?

Slide 11

Slide 11 text

How the business names things TV Window Chair Trolley Painting Desk

Slide 12

Slide 12 text

How the business names things TV Window Chair Trolley Painting Desk How developers name things TransparencyFactory RollableStuffContainer EntertainmentProviderSingleton DecoratorImpl RestProvider WorkEnablementDevice

Slide 13

Slide 13 text

A B C „Gut, dass wir alle einer Meinung sind!“ Inspiriert durch Jeff Patton & Luke Barren „good, that we all share the same opinion“ Inspired by Jeff Patton and Luke Barren

Slide 14

Slide 14 text

AB C AB C Inspiriert durch Jeff Patton & Luke Barren AB C „OH!“ „Aha!“ „Gut, dass wir alle einer Meinung sind!“ „good, that we all share the same opinion“ Inspired by Jeff Patton and Luke Barren

Slide 15

Slide 15 text

14 Problem vs Solution Space Strategic Design starts with the problem space, which represents the business architecture and which includes problem domains and (categorized) subdomains. The solution space represents the software architecture and contains the bounded context. There must be an overlap between the two. Problem Space „what we want to solve“ Solution Space „how we solve something“ Domain Subdomain Bounded Context

Slide 16

Slide 16 text

15 The bigger the alignment between problem and solution space, the better However, you’ll never be perfect

Slide 17

Slide 17 text

The domain should be the heart of a system

Slide 18

Slide 18 text

The domain should be the heart of a system Collaborative Modelling Continuous Learning Focus on linguistic details Inclusive Environment

Slide 19

Slide 19 text

17 DDD enables Continuous Discovery 1. De ine a business problem 2. De ine the desired result 3. De ine your assumptions 4. Hypothesis: write your tests irst 5. Conduct experiments 6. Consolidate the results 7. Discard / modify / keep 8. Repeat Ideas Measure Test Build Data Learn Product

Slide 20

Slide 20 text

18 Don’t… •use technical modelling tools which only the IT is capable of •create communication barriers between business and IT Do… •make sure that workshops are inclusive for everyone •use techniques for collaborative modelling

Slide 21

Slide 21 text

<> Event Storming <> Domain Storytelling 19 Popular Collaborative Modelling Techniques <> Example Mapping <> User Story Mapping

Slide 22

Slide 22 text

20 Problem Domain A good understanding of the problem domain is key for a decoupled software architecture which re lects the business •Collaborative Modelling helps in shaping a common understanding of the problem domain Domain Experts Dev Team Collaborative Modelling Problem Domain help to understand

Slide 23

Slide 23 text

21 Subdomains •Each problem domain can contain some subdomains •These subdomains are lower level business capabilities than the ones of a domain •The identi ication of subdomains is usually performed by collaborative modeling •Prefer modern collaborative modelling techniques over UML, BPNM or other technical tools Domain Experts Dev Team Collaborative Modelling Problem Domain help to identify Subdomain A Subdomain B Subdomain C Subdomain D

Slide 24

Slide 24 text

22 Categories for Subdomains Subdomain Core (Sub)domain • Most important subdomain • The heart of an organization’s business • Differentiation against competitors Supporting Subdomain • Vital for the operating of core (sub)domains • Lack of strategic relevance with regards to competition Generic Subdomain • Needed functionality, which is not critical at all • „We need some solution of problem x“

Slide 25

Slide 25 text

„Not all parts of a system will be well designed“ Eric Evans Author (and inventor) of „Domain-Driven Design“ 23

Slide 26

Slide 26 text

24 The categorization of subdomains should have an impact on staf ing, make or by decisions and IT-procurement Core (Sub)domain • In-House development • Excellent teams with excellent working conditions • Staf ing strategy should be „insourcing“ • No Near- / Off-Shore development • No „Custom Off The Shelf“ (COTS / Standard) Software Supporting Subdomain • In-House development with external support is possible • Some Near-Shore development is an option • „Custom Off The Shelf“ (COTS / Standard Software) products that its your processes with minor customizations • Avoid complete outsourcing and / or major customizations of COTS products Generic Subdomain • Look of COTS or SaaS Products that get „the task done“ • Staf ing strategy can be „outsourcing“ • Look for cost saving opportunities • Don’t put your best employees into generic subdomains • Vendor Management is a key skill in this area Cost Focus

Slide 27

Slide 27 text

25 Problem vs Solution Space Strategic Design starts with the problem space, which represents the business architecture and which includes problem domains and (categorized) subdomains. The solution space represents the software architecture and contains the bounded context. There must be an overlap between the two. Solution Space Problem Space Domain Subdomain Bounded Context

Slide 28

Slide 28 text

25 Problem vs Solution Space Strategic Design starts with the problem space, which represents the business architecture and which includes problem domains and (categorized) subdomains. The solution space represents the software architecture and contains the bounded context. There must be an overlap between the two. Solution Space Problem Space Domain Subdomain Bounded Context

Slide 29

Slide 29 text

26 Centralized models lead to many dependencies

Slide 30

Slide 30 text

27 The language for loan application form may differ Loan Application Form Loan Applications Loan Application Form Scoring Applicant Scoring Cluster Financial Situation Scoring Cluster Applied Credit Scoring Cluster Credit Decision Credit Decision Template Contracting Contract Proposal Contract

Slide 31

Slide 31 text

The bounded context is a linguistic boundary around the meaning of a (domain) model 28

Slide 32

Slide 32 text

29 Each subdomain can have 1..n bounded contexts and each context has its own model. In an ideal world you have a 1:1 alignment between the both. Loan Applications Scoring Credit Decision Contracting Credit Sales Funnel Document Check Internal Scoring Security Assessment External Scoring Credit Decision Contract Proposal Contract Creation Credit Application Applicant Document Rule Clusters Securities External Rating Decision Template Decision Hierarchy Decision Contract Proposal Contract

Slide 33

Slide 33 text

30 At a later step you may want to re-adjust your business architecture expressed as subdomains. Credit Sales Funnel Document Check Internal Scoring Security Assessment External Scoring Credit Decision Contract Proposal Contract Creation Credit Application Applicant Document Rule Clusters Securities External Rating Decision Template Decision Hierarchy Decision Contract Proposal Contract

Slide 34

Slide 34 text

The decentralization of domain models with bounded contexts has many advantages The domain models are more explicit and better suited to ful ill the capabilities of the bounded context. By having specialized models, the teams working with them gain a better understanding of the business, the mental model of the dev team and the domain experts align and they can deliver higher quality results which are more maintainable. The decentralization leads to a higher cohesion inside of a bounded context and reduces dependencies between teams. More work can be done in parallel. Due to a higher degree of decoupling between bouded contexts the teams working on them can choose different implementation options. But: mind macro architecture

Slide 35

Slide 35 text

32 Identi ication of bounded contexts The identi ication of bounded contexts should never be driven from one criteria. Instead evaluate a weighted set of criteria and invite the following stakeholders: •Developers / Architects •Domain Experts •UX Experts •Maybe a facilitator

Slide 36

Slide 36 text

Decomposition of a subdomain in bounded contexts Ubiquitous Language • Key actors • Important verbs • Terminology Quality Criteria • Also known as non- functional requirements • Look at ISO 25010 • Examples: • Scalability • Performance • Change frequency 33 Capabilities & Responsibilities • Informational: • Queries • Reports • Actions: • Commands / Features • Scheduled tasks Business Policies • Important rules • Validations • Policies

Slide 37

Slide 37 text

Also take a look at the amazing Bounded Context Canvas by Nick Tune https://medium.com/nick-tune-tech-strategy-blog/bounded-context-canvas-v2-simpli ications-and-additions-229ed35f825f

Slide 38

Slide 38 text

Decomposition of a subdomain in bounded contexts Ubiquitous Language • Key actors • Important verbs • Terminology Quality Criteria • Also known as non- functional requirements • Look at ISO 25010 • Examples: • Scalability • Performance • Change frequency 35 Capabilities & Responsibilities • Informational: • Queries • Reports • Actions: • Commands / Features • Scheduled tasks Business Policies • Important rules • Validations • Policies Mind the amount of teams you have available as well

Slide 39

Slide 39 text

„Team assignments are the irst draft of the architecture” Michael Nygard Author of „Release It“ 36

Slide 40

Slide 40 text

37 Let’s say we have a total of 50 people to build teams? How do we distribute them? Credit Sales Funnel Document Check Internal Scoring Security Assessment External Scoring Credit Decision Contract Proposal Contract Creation Credit Application Applicant Document Rule Clusters Securities External Rating Decision Template Decision Hierarchy Decision Contract Proposal Contract

Slide 41

Slide 41 text

37 Let’s say we have a total of 50 people to build teams? How do we distribute them? Credit Sales Funnel Document Check Internal Scoring Security Assessment External Scoring Credit Decision Contract Proposal Contract Creation Credit Application Applicant Document Rule Clusters Securities External Rating Decision Template Decision Hierarchy Decision Contract Proposal Contract or

Slide 42

Slide 42 text

37 Let’s say we have a total of 50 people to build teams? How do we distribute them? Credit Sales Funnel Document Check Internal Scoring Security Assessment External Scoring Credit Decision Contract Proposal Contract Creation Credit Application Applicant Document Rule Clusters Securities External Rating Decision Template Decision Hierarchy Decision Contract Proposal Contract

Slide 43

Slide 43 text

Heuristics for team distribution 38 Things to keep in mind 5-9 people per team Mind cognitive load of a team „You design it, you build it, you run it“ Mind communication bandwidth Take subdomains into account

Slide 44

Slide 44 text

39 “An architect should be thinking: Which team interaction modes are appropriate for these two teams? What kind of communication do we need between these two parts of the system, between these two teams?“

Slide 45

Slide 45 text

Team Interaction Modes Image taken from the Team Topologies book

Slide 46

Slide 46 text

41 Coupling of bounded contexts Although bounded contexts aim for a high degree of decoupling there needs to be some kind of connection between: •The teams •The software •The business capabilities

Slide 47

Slide 47 text

Context Maps aim to deliver a holistic overview with regards to coupling of bounded contexts 42

Slide 48

Slide 48 text

43 Interactions between Bounded Contexts and teams Call Flow How are calls and events lowing within a system / context landscape? Model Propagation How do models propagate between systems? Where are boundaries? In luence of Actions How do the actions of one team affect other teams? Who in luences whom? or or Team Communication / Politics How do teams communicate with each other? Where are politics being played? or or

Slide 49

Slide 49 text

44 Where should context maps help? Governance A Context Map helps to identify governance issues between applications and teams. Transformation A Context Map is an excellent starting point for future transformations: it gives an in-depth insight into integration aspects and subdomain / context relations Bad Models By introducing a Context Map we get a clear view on where and how bad models propagate through application landscapes Politics By not just looking at technical integration aspects the Context Map also helps us in seeing how teams communicate and „play politics“.

Slide 50

Slide 50 text

45 Dependencies between teams Team Dependencies Mutually Dependent • Two software artifacts or systems in two bounded contexts need to be delivered together to be successful and work. • There is often a close, reciprocal link between data and functions between the two systems. Free • Changes in one bounded context do not in luence success or failure in other bounded contexts. • There is, therefore, no organizational or technical link of any kind between the teams. Upstream / Downstream • An upstream context will in luence the downstream counterpart while the opposite might not be true. • This might apply to code but also on less technical factors such as schedule or responsiveness to external requests.

Slide 51

Slide 51 text

46 A brief overview of some of the context map patterns Open-host Service • Public API • One provider, several consumers • General purpose • Always upstream Anticorruption Layer Translation Iayer Model-to-Model transformation Reduces the amount of coupling Always downstream • • • • Published Language • Shared „ubiquitous“ language • Often de ined by a consortium • Can be combined with Open-host service • Examples: iCalendar, vCard, Zugferd Conformist One team adheres to an external model No translation of external models Motivation: simplicity or force Always downstream • • • • Shared Kernel • Shared artifact • Can be shared code, shared databases or shared libraries Customer / Supplier The downstream team can make demands The upstream has to ful ill them Negotiate and budget tasks Upstream / downstream • • • •

Slide 52

Slide 52 text

47 System ABC System Y You can visualize different perspectives • Call Relationship

Slide 53

Slide 53 text

47 System ABC Upstream Downstream System Y You can visualize different perspectives • Call Relationship • Team Relationship - Level 1

Slide 54

Slide 54 text

47 System ABC Upstream Downstream System Y Open Host Service You can visualize different perspectives • Call Relationship • Team Relationship - Level 1 • API Level

Slide 55

Slide 55 text

47 System ABC Upstream Downstream System Y Open Host Service Anticorruption Layer You can visualize different perspectives • Call Relationship • Team Relationship - Level 1 • API Level • Model Propagation

Slide 56

Slide 56 text

47 System ABC Upstream Downstream System Y Open Host Service Anticorruption Layer You can visualize different perspectives Customer Supplier • Call Relationship • Team Relationship - Level 1 • API Level • Model Propagation • Team Relationship - Level 2

Slide 57

Slide 57 text

48 Context Map The context map is a powerful tool for •making implicitly hidden organizational processes visible •identify the low of bad domain models •establishing a decentralized governance model

Slide 58

Slide 58 text

Alignment through Strategic DDD Orgainzation Team Topologies Context Maps Problem Space Problem Domain Subdomains Solution Space Bounded Context

Slide 59

Slide 59 text

50 Domain-driven Design is an holisitic approach towards Software Architecture which goes beyond technical aspects by addressing cultural and organizational aspects of a delivery organization as well.

Slide 60

Slide 60 text

Get my DDD book cheaper Book Voucher: 7.99 instead of (min) 9.99 http://leanpub.com/ddd-by-example/c/speakerdeck

Slide 61

Slide 61 text

Krischerstr. 100 40789 Monheim am Rhein Germany +49 2173 3366-0 Ohlauer Str. 43 10999 Berlin Germany +49 2173 3366-0 Ludwigstr. 180E 63067 Offenbach Germany +49 2173 3366-0 Kreuzstr. 16 80331 München Germany +49 2173 3366-0 Hermannstrasse 13 20095 Hamburg Germany +49 2173 3366-0 Gewerbestr. 11 CH-6330 Cham Switzerland +41 41 743 0116 innoQ Deutschland GmbH innoQ Schweiz GmbH www.innoq.com 52 Thank you! Michael Plöd Follow me on Twitter: @bitboss