Slide 1

Slide 1 text

Visualizing Sociotechnical Architectures with Context Maps Michael Plöd

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

3 My assuptions / prerequisites You know about (Sub)domains, Bounded Contexts, Domain Models and Integration. You don’t need to be an expert. I will talk about Context Maps: their motivation, the patterns, their use cases, a few heuristics and how to apply them. In addition to that I will also look at other options. I will NOT talk about REST, WebServices, Apache Kafka, Microservices or other technical integration stuff.

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

5 McKinsey: „At larger companies, structural issues are the top hurdle to meeting digital goals“ Quelle: https://www.mckinsey.com/business-functions/digital-mckinsey/our-insights/the-digital-tipping-point-mckinsey-global-survey-results „Focus on organization-wide impact. Companies expect much of their near- term growth to be driven by digital, but impact remains elusive. What’s more, effective organizational structures, accountability, and meaningful metrics and incentives are largely lacking. As executives become more involved in digital efforts, they must work to ensure that their structures and business processes are set up to take full advantage of the opportunities that digital efforts offer.“

Slide 6

Slide 6 text

6 Domain-driven Design contains sociotechnical aspects which can enable teams to be autonomous and to deliver value at speed by decentralizing governance aspects

Slide 7

Slide 7 text

7 Centralized models lead to many dependencies

Slide 8

Slide 8 text

8 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 9

Slide 9 text

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

Slide 10

Slide 10 text

10 In an ideal world we want to align Subdomains and Bounded Contexts 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 11

Slide 11 text

„Team assignments are the first draft of the architecture” Michael Nygard Author of „Release It“ 11

Slide 12

Slide 12 text

12 Let’s say we have a total of 50 people to build teams? How do we distribute them? 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 or

Slide 13

Slide 13 text

Heuristics for team distribution 13 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 bandwith Take subdomains into account

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

15 The categorization of subdomains should have an impact on staffing, make or buy decisions and even IT-procurement Core (Sub)domain • In-House development • Excellent teams with excellent working conditions • Staffing 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 fits 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“ • Staffing 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 Focus Cost

Slide 16

Slide 16 text

Wardley Maps can also provide valuable insights Image Credit: https://medium.com/@rbouma/lean-agile-scotland-2016-c3756adcb18d

Slide 17

Slide 17 text

Make sure that your core (sub)domains and / or your most valuable contexts in genesis and custom built phases are perfectly staffed 17

Slide 18

Slide 18 text

18 Fundamental Team Topologies Complicated Subsystem Enabling Platform Stream-aligned

Slide 19

Slide 19 text

19 Subdomains + Team Topologies Core (Sub)domain Supporting Subdomain Generic Subdomain

Slide 20

Slide 20 text

20 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 21

Slide 21 text

Team B Team A ?

Slide 22

Slide 22 text

22 “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 23

Slide 23 text

Team Interaction Modes Collaboration X-as-a-Service Facilitating Image taken from the Team Topologies book

Slide 24

Slide 24 text

Team Interaction Modes Image taken from the Team Topologies book

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

26 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 influence 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 influence 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 27

Slide 27 text

27 Systems calling each other or consuming events Some Bank Schufa WS Calls a WebService Scoring Credit Application Sales Funnel Domain Event Consumes

Slide 28

Slide 28 text

Some Bank Schufa WS Scoring Credit Application Sales Funnel Domain Event 28 The propagation of models Schufa Result Credit Application

Slide 29

Slide 29 text

29 Teams communicating with each other Some Bank Schufa WS Scoring Credit Application Sales Funnel Domain Event

Slide 30

Slide 30 text

30 Teams communicating with each other Some Bank Schufa WS We will adjust the interface and the underlying model with the next release. Ok no problem, just send us the documentation.

Slide 31

Slide 31 text

31 Teams communicating with each other Scoring Credit Application Sales Funnel Domain Event We will deprecate the domain event and replace it with a new one. We have neither the budget, nor the capacity to implement that change.

Slide 32

Slide 32 text

Schufa REST 32 Actions of one team have an impact on others Some Bank WS We will replace the WebService with RESTful Resources next week. Some Bank

Slide 33

Slide 33 text

These patterns address a diverse variety of perspectives 33 The context map uses patterns to describe the contact between bounded contexts and teams Shared Kernel Customer / Supplier Conformist Anticorruption Layer Separate Ways Open / Host Service Published Language Partnership Big Ball Of Mud

Slide 34

Slide 34 text

Schufa OHS 34 Open-host Service WebService The Open-host Service is a public API •One API for several consumers •No point-to-point API •Has a common, general purpose model and functionality •The team providing the Open-host Service is an upstream team Bank A Bank B U D D

Slide 35

Slide 35 text

35 Anticorruption Layer The Anticorruption Layer translates one model to another one •Transforms an external model from another team / bounded context / system to another internal one •Reduces the amount of coupling to a single layer •The team implementing an Anticorruption Layer is always downstream Credit Sales Funnel Scoring OHS ACL U D Credit Application Person Scoring Credit Scoring Security Scoring

Slide 36

Slide 36 text

36 Conformist The Conformist slavishly adheres to the upstream model •There is no model-to-model transformation •Motivation: Simplicity, contracts, force or delight (for the upstream model) •The team implementing a Conformist is always downstream Credit Sales Funnel Scoring OHS CF U D Credit Application

Slide 37

Slide 37 text

37 Conformist couples the core of your domain model to the external model Anticorruption Layer reduces the coupling to the adapters

Slide 38

Slide 38 text

38 Heuristics for choosing a Conformist The degree of coupling and also connascence of a Conformist is higher compared to an Anticorruption Layer but there are a few situations in which a Conformist may still be the better choice. •One Bounded Context provides computations, that are highly regulated by legal authorities (collateral value of a real estate for example) •One team / Bounded Context is considered to be a specialist in aggregations or computations and we don’t want others to alter their results.

Slide 39

Slide 39 text

39 Shared Kernel Shared Kernel is a subset of a domain model that two teams share •„Physically“ shared artifact between two teams •Examples: shared JARs or database •High degree of coupling requires a high amount of coordination between the involved teams •Shared Kernel is no Anti-Pattern but use with caution Credit Sales Funnel Scoring Credit Application SK

Slide 40

Slide 40 text

40 Heuristics for Shared Kernels A Shared Kernel introduces a high degree of coupling between the teams and their software and is, therefore, often considered not to be a good option. However, there are situations in which a Shared Kernel may be a good idea: •One team is responsible for two or more bounded contexts which have an overlap in terms of language •Strictly avoid a Shared Kernel when two teams are in a competitive situation or where a lot of backdoor politics are being played •When two teams have a Shared Kernel, they should form a Partnership…

Slide 41

Slide 41 text

Scoring Credit Sales Funnel 41 Partnership Partnership is about cooperative relationships between teams •Establishes a process for coordinated planning of development and joint management of integration •Not technical at all, Partnership is plain organizational •Recommended for teams which depend on a Shared Kernel We want to adjust something Ok, let’s coordinate our efforts

Slide 42

Slide 42 text

42 Customer-Supplier A Customer-Supplier development gives the downstream team some influence •Downstream requirements factor into upstream planning. Therefore, the downstream team gains some influence over the priorities and tasks of the upstream team •Customer-Supplier is organizational •Mind „vetoing customer“ and customer against an OHS as anti-patterns Credit Sales Funnel Scoring CUS SUP U D We need more fields in the application Ok

Slide 43

Slide 43 text

43 Separate Ways A bounded context has no connections to others •Sometimes integration is too expensive or takes very long •The teams choose separate ways in order to focus on specialized solutions •Interesting pattern for minimum viable products or organizational solutions in uncertain market conditions Credit Sales Funnel Contract Offering and Creation Manual process for entering credit application data in contract SW

Slide 44

Slide 44 text

44 Published Language A well documented language shared between bounded contexts •Every bounded context can translate in and out from that language •Sometimes defined by a consortium of the most important stakeholders / teams •Often combined with Open-host Service •Examples: iCalendar, vCard, ZugFerd Credit Sales Funnel Credit Application Scoring Real Estate Rating Contract Proposal PL

Slide 45

Slide 45 text

Core Banking System 45 Big Ball Of Mud A (part of a) system which is a mess by having mixed models and inconsistent boundaries •Don’t let the (lousy) model of the Big Ball Of Mud propagate into your context •Anticorruption Layer is the pattern of choice on the downstream •Demarcation of bad model or system quality BBoM Contract Creation ACL

Slide 46

Slide 46 text

46 The patterns address various aspects Team Relationships Model Propagation API / „technical“ Open-host Service (✅) ✅ Anticorruption Layer ✅ Conformist ✅ Shared Kernel ✅ (✅) Partnership ✅ Customer-Supplier ✅ Separate Ways ✅ (✅) Published Language ✅ (✅) Big Ball Of Mud ✅

Slide 47

Slide 47 text

47 Some of the patterns reflect team relationships Team Relationships Mutually Dependent • Partnership • Shared Kernel Free • Separate Ways • Published Language Upstream / Downstream • Customer-Supplier • Anticorruption Layer • Conformist • Open-host Service

Slide 48

Slide 48 text

48 Mind team communication Team independence Tight Coupling / Integration Shared Kernel Customer / Supplier Conformist Anticorruption Layer Separate Ways Open / Host Service Published Language Team Communication

Slide 49

Slide 49 text

49 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 50

Slide 50 text

Ask those questions 50 Subdomain categories and the context map Should a generic or supporting subdomain be a customer for a supplier in a core domain? Should a core domain conform to the model of a generic or supporting subdomain? How do we deal with a Big Ball Of Mud in a core domain? Conform to it in the other categories? Do we want Partnerships or mutually dependent teams between core and the other subdomains?

Slide 51

Slide 51 text

51 Also look at bounded context model traits Influence of an Octopus Enforcer? Bubble Context for Bubble Context? Mind the Enterprise Integration Patterns!

Slide 52

Slide 52 text

Some examples in which Context Maps make implicit issues explicit 52

Slide 53

Slide 53 text

53 System ABC Open Host Service Upstream Downstream System X Anticorruption Layer System Y Anticorruption Layer System Z Anticorruption Layer POLITICAL FOUL PLAY „Vetoing“ Customer „Helpless“ Supplier

Slide 54

Slide 54 text

54 The model propagation from hell U D D U U D Credit Application Scoring Credit Agency Customer Customer Contact O H S C F S K CF ACL OHS O H S Rating Model Customer Model

Slide 55

Slide 55 text

55 Context Map Scenarios Taken from my Domain-driven Design book •These scenarios showcase various options / alternatives •Domain: retail mortgage loans •https://www.leanpub.com/ddd- by-example

Slide 56

Slide 56 text

56 How teams gain influence

Slide 57

Slide 57 text

57 Degrading influence of a team

Slide 58

Slide 58 text

58 Using a Published Language

Slide 59

Slide 59 text

59 Dealing with a Big Ball Of Mud

Slide 60

Slide 60 text

60 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 61

Slide 61 text

61 Context Map The context map is a powerful tool for •making implicitly hidden organizational processes visible •identify the flow of bad domain models •establishing a decentralized governance model •PS: managers LOVE context maps ;-)

Slide 62

Slide 62 text

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

Slide 63

Slide 63 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 63 Thank you! Michael Plöd Follow me on Twitter: @bitboss