Slide 1

Slide 1 text

How to break down a domain to bounded contexts?

Slide 2

Slide 2 text

>  Oliver Tigges, @otigges, oliver.tigges@innoq.com >  innoQ, http://innoQ.com >  Software develop & IT consultant since 2001 >  many domains and businesses: banking, payment, insurance, e-commerce, industrial, media, railway, environmental agencies, medical, de-mail, IoT, internet start ups, etc. About me

Slide 3

Slide 3 text

>  Goal: Find adequate and sustainable Bounded Contexts in your domain >  What are the most important influence factors? >  What are suitable approaches and methods? >  Context: Distributed applications, Microservices architectures About this talk

Slide 4

Slide 4 text

>  Before we talk about „how“... >  Let‘s talk about: >  Why? >  Who? >  When?

Slide 5

Slide 5 text

>  Goal: Independence of systems and teams Design & Implementation Releasing & Deployment Runtime & Operations 1 2 3

Slide 6

Slide 6 text

How to achieve this? >  Bounded contexts >  (Self contained) Systems matching these bounded contexts

Slide 7

Slide 7 text

Customer Account Booking Rating Debit Cards Credit Cards Account Statement Credit Offer Credit Contract Credit Line Contact History Settings Standing Order Direct Debit Transaction Installment Credit Sales Context Accounting Context CRM Context Cards Context Interest Account Customer Contract

Slide 8

Slide 8 text

Messaging Domain Event Subscribe Publish Customer Supplier Bounded Context B Bounded Context A Bounded Context C Conformist User interface Business logic Data storage SCS B User interface Business logic Data storage SCS C User interface Business logic Data storage SCS A Team A Team B Team C Synchronous call Asyncronous call Asyncronous call UI Integration

Slide 9

Slide 9 text

Actually in most projects: >  Software developers & architects Who identifies contexts? Alberto Brandolini says: >  Domain experts >  Dev team >  UX experts >  Facilitator

Slide 10

Slide 10 text

Approach

Slide 11

Slide 11 text

>  If Bounded Context defines the technical system boundaries, it not only partitions domain model but also defines units for: >  development (teams) >  deployment >  availability >  scalability >  security zones Context boundary == System boundary

Slide 12

Slide 12 text

1.  Domain model: Domain objects and their relations 2.  Use Cases, processes and workflows 3.  Quality goals, non-functional requirements 4.  Organizational aspects What to consider?

Slide 13

Slide 13 text

>  Identify domain objects: events, aggregates, etc. >  Analyze and describe relations between domain objects >  Be aware of an object’s varying charachteristics in different use cases >  Maybe try Event Storming, Alberto Brandolini Domain model

Slide 14

Slide 14 text

>  Identify processes that need to be owned and controlled by one person in charge and one team >  Concentrate responsibility for business goals / KPIs in one hand >  Examples: User registration, eCommerce checkout, conversion rates Process ownership

Slide 15

Slide 15 text

>  Derived from business goals >  Examples: >  Time 2 Market (release/deployment cycles) >  Security >  Availability >  Load and performance (read/write) >  Scalability >  User experience >  … Quality goals

Slide 16

Slide 16 text

>  Do you have authorization and power to adapt the organization to your system design? >  What are the constraints you can‘t change? >  Corporate structures >  Teams, people and skillsets >  … Organizational constraints

Slide 17

Slide 17 text

Domain Model Quality goals Organizational constraints Process ownership

Slide 18

Slide 18 text

>  Like every process in software architecture and development: >  Iterative >  Identify system candidates >  Evaluate >  Trade-offs >  Repeat Approach Identify candidates Challenge & Evaluate Trade-Off Decissions

Slide 19

Slide 19 text

Example Retail Banking

Slide 20

Slide 20 text

Find initial system candidates Customer Account Booking Rating Debit Cards Credit Cards Account Statement Credit Offer Interest Credit Contract Credit Line Contact History Settings Standing Order Direct Debit Transaction Installment

Slide 21

Slide 21 text

Find initial system candidates Customer Account Booking Rating Debit Cards Credit Cards Account Statement Credit Offer Interest Credit Contract Credit Line Contact History Settings Standing Order Direct Debit Transaction Installment Credit Account Customer Cards

Slide 22

Slide 22 text

>  Looking at the domain model you could identify these candidates for Bounded Contexts / systems: Initial candidates Customer Account Cards Credit

Slide 23

Slide 23 text

>  Typical change scenarios in our example system >  Implement additional TAN method >  New credit product >  New conditions for loans >  Changes in legal or supervisory regulations >  Reversal of design decisions >  Observe potential issues >  Number of systems that need to be changed and released for a change >  Coordination efforts over several teams Challenge system candidates

Slide 24

Slide 24 text

Scenario Customer Account Cards Credit Change of credit conditions S S - L New verification method S L L - Change of external rating agency L - - M New credit product - - - L …

Slide 25

Slide 25 text

>  Identify main building blocks and use cases of each system candidate >  List quality requirements of each building block >  Security (PCI scope?) and data privacy (personal data?) >  Time to market, expected release frequency >  Availability, max downtime, max recovery time >  User groups and UX requirements >  Performance, response times, throughput, reads/writes >  And other relevant requirements >  Quality requirements of system are the sum of their building block‘s requirements Quality requirements

Slide 26

Slide 26 text

~ 10 Employees/clerks Users > 100,000 Customers functional, experts UI/UX customer experience low Availability high complex, versioned Data model simple, flat few reads/writes Data access many reads monthly Releasing daily System candidate „Credit“ <> Credit Offering Configuration <> Credit Sales Process … … Credit expert Customer

Slide 27

Slide 27 text

Pub/Sub New Credit Offering Iteration 1 Customer Account Cards Credit Offerings Credit Sales

Slide 28

Slide 28 text

>  Some processes will span several of identified system candidates, e.g.: >  Sales processes for credits/loans: Customer, Account, Credit Sales >  Probably one owner should be responsible for: >  End to end functionality >  Consistent, smooth user experience Process ownership

Slide 29

Slide 29 text

Customer Account Credit Sales Customer Credit Sales Choose Product Calculate Conditions Credit Rating Credit Account (or refusal) Customer data (Sign-Up | Load)

Slide 30

Slide 30 text

Choose Product Calculate Conditions Credit Rating Credit Account (or refusal) Customer data (Sign-Up | Load) Credit Sales

Slide 31

Slide 31 text

Pub/Sub Contract Created Customer Created <> Rating Customer Account Cards Credit Offerings Credit Sales

Slide 32

Slide 32 text

>  System design could/should reflect structures of the organization: >  By products: debit, credit, investment, real estate >  By sales channels: direct, stationary, brokers, agencies >  By customer segments: existing customers, new customers, high-networth, etc. >  By any informal structures developed by people or history Organizational aspects

Slide 33

Slide 33 text

Customer Account Cards Credit Offerings Credit Sales Debit Consumer Credits Home Loans

Slide 34

Slide 34 text

Customer Account Cards Credit Offerings Credit Sales Customer Care Customer Akquisition …

Slide 35

Slide 35 text

Customer Care Account Cards Credit Offerings Customer Aquisition Customer Care Customer Akquisition …

Slide 36

Slide 36 text

Choose Product Calculate Conditions Credit Rating New Customer (or refusal) Customer data (Registration) Customer Acquisition Self Care Up Selling Credit Rating New Contract (or refusal) Calculate Conditions Customer Care

Slide 37

Slide 37 text

Account Cards Credit Offerings Pub/Sub Customer Care Customer Acquisition Contract Created Customer Created

Slide 38

Slide 38 text

Customer Acquisition Account Cards Credit Offerings Customer Care Team A Team B Team C PO 1 PO 2

Slide 39

Slide 39 text

Wrap-up

Slide 40

Slide 40 text

>  Record system design decisions: >  Options considered >  Options discarded >  Reason for discarding >  Advantages for current design >  Document assumptions, quality requirements and organizational constraints Practical tips

Slide 41

Slide 41 text

>  Finding sustainable, autonomous SCS can be a long- running process >  Right people: Domain experts, product owners and architects/engineers should work out the system design cooperatively >  There are a lot of aspects to consider and trade-offs to be made >  The iterative process of challenging and adapting the system design is never finished. Conclusion

Slide 42

Slide 42 text

Thank you