7 YEARS OF DDD or Tackling Complexity in Large Scale Marketing - - PowerPoint PPT Presentation

7 years of ddd
SMART_READER_LITE
LIVE PREVIEW

7 YEARS OF DDD or Tackling Complexity in Large Scale Marketing - - PowerPoint PPT Presentation

7 YEARS OF DDD or Tackling Complexity in Large Scale Marketing Systems vladikk YAY!!! @vladikk vladikk.com Internovus PART 1 5 BOUNDED CONTEXTS PART 2 5 PRACTICAL ADVICES vladikk Your Product Marketing Creatives


slide-1
SLIDE 1 vladikk

7 YEARS OF DDD

  • r

Tackling Complexity in
 Large Scale Marketing Systems

slide-2
SLIDE 2

YAY!!!

slide-3
SLIDE 3

@vladikk vladikk.com Internovus

slide-4
SLIDE 4 vladikk

PART 2 


5 PRACTICAL ADVICES

PART 1


5 BOUNDED CONTEXTS

slide-5
SLIDE 5
slide-6
SLIDE 6 vladikk Your Product Marketing
 Strategy Creatives Campaigns Sales
 Agents Optimization Profits
slide-7
SLIDE 7 vladikk

THE FIRST BOUNDED CONTEXT

01

slide-8
SLIDE 8 vladikk

Media Buying Creatives Catalog Campaign Management

VER 1.0

slide-9
SLIDE 9 vladikk

🤕

slide-10
SLIDE 10 vladikk
slide-11
SLIDE 11

Very nice!!!1

slide-12
SLIDE 12 vladikk

Aggregates everywhere!!!

slide-13
SLIDE 13 vladikk

Aggregates everywhere!!!

Creative Agency Advertiser

Publisher Website Placement Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit

Campaign

slide-14
SLIDE 14 vladikk

The Bounded Context

Creative Agency Advertiser Publisher Website Placement Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience
slide-15
SLIDE 15 vladikk Domain Model Service / Application Layer Presentation Infrastructure Anemic! Behaviour
slide-16
SLIDE 16 vladikk

Imperfect architecture “QA is for cowards”

BUT IT WORKED!

slide-17
SLIDE 17 vladikk

UBIQUITOUS LANGUAGE

slide-18
SLIDE 18 vladikk Domain Experts Software Developers No experience in online marketing Nice people!
slide-19
SLIDE 19 vladikk Smooth communication Strong grasp of the business domain Working software Aggressive time to market
slide-20
SLIDE 20 vladikk Ubiquitous Language Anemic Domain Model
slide-21
SLIDE 21 vladikk Leads Sales Agents Ads
slide-22
SLIDE 22 vladikk Leads CRM Categorize Desk Desk Desk Sales Agents Sales Agents Sales Agents
slide-23
SLIDE 23 Leads CRM Categorize Desk Desk Desk Sales Agents Sales Agents Sales Agents Clients’ Systems
slide-24
SLIDE 24 vladikk
slide-25
SLIDE 25 vladikk Lead qualification Agent qualification Agents’ commissions
slide-26
SLIDE 26 vladikk

THE CRM BOUNDED CONTEXT

02

slide-27
SLIDE 27 vladikk Ubiquitous Language Anemic Domain Model
slide-28
SLIDE 28 vladikk Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Placement Visit Brand Marketing Lead CRM Lead Marketing Campaign CRM Campaign
slide-29
SLIDE 29 vladikk Domain Experts Software Developers …. Lead …. …. Campaign…
slide-30
SLIDE 30 vladikk
slide-31
SLIDE 31
slide-32
SLIDE 32 vladikk

BOUNDED CONTEXTS PROTECT THE LANGUAGE AGGREGATES PROTECT CONSISTENCY OF DATA

slide-33
SLIDE 33 vladikk Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Placement Visit Brand Marketing Lead CRM Lead Marketing Campaign CRM Campaign
slide-34
SLIDE 34 vladikk Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Placement Visit Lead Campaign Marketing Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Brand Lead Campaign CRM
slide-35
SLIDE 35 vladikk

Aggregates will:


  • Protect transactional boundaries

  • Encompass business logic and invariants
Domain Service / Application Layer Presentation Infrastructure
slide-36
SLIDE 36 vladikk

Aggregates will:


  • Protect transactional boundaries

  • Encompass business logic and invariants
Domain Service / Application Layer Presentation Infrastructure Domain Service / Application Layer
slide-37
SLIDE 37
slide-38
SLIDE 38 vladikk
slide-39
SLIDE 39
slide-40
SLIDE 40 vladikk

Stored procedures???

slide-41
SLIDE 41 vladikk Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Brand Lead Campaign Lead
slide-42
SLIDE 42

L e a d

CRM Team

DBA Team

slide-43
SLIDE 43
slide-44
SLIDE 44 vladikk Inconsistent models No shared understanding Duplication of knowledge Went out of sync quickly NIGHTMARE
slide-45
SLIDE 45 vladikk Wasn’t delivered on time Production issues Data corruption Thrown away and reimplemented
slide-46
SLIDE 46 vladikk Ubiquitous Language Domain Model Bounded Contexts Protect w/ Implement as
slide-47
SLIDE 47

Not all of a large system will be well designed

Eric Evans

slide-48
SLIDE 48 vladikk

THE CRUNCHERS BOUNDED CONTEXT

03

slide-49
SLIDE 49 vladikk Marketing CRM Analysis Customer Events Marketing CRM
slide-50
SLIDE 50 vladikk Marketing CRM Analysis Customer Events Event Crunchers
slide-51
SLIDE 51 vladikk Competitive advantage? - No Off-the-shelve solution? - No => Supporting sub-domain
slide-52
SLIDE 52 vladikk Layered Architecture Transaction Script Worked …. for a while
slide-53
SLIDE 53 vladikk Customer Events Event Crunchers Marketing CRM Analysis Flag Flag Calculated fields
slide-54
SLIDE 54 vladikk
slide-55
SLIDE 55 vladikk Marketing CRM Analysis Customer Events Event Crunchers
slide-56
SLIDE 56 vladikk Customer Events Event Crunchers (BBOM) CRM Marketing Analysis
slide-57
SLIDE 57 vladikk Customer Events Event Crunchers (Event Sourced) CRM Marketing Analysis
slide-58
SLIDE 58 vladikk

THE BONUSES BOUNDED CONTEXT

04

slide-59
SLIDE 59 vladikk Sales Commissions Reports
slide-60
SLIDE 60 vladikk Competitive advantage? - No Off-the-shelve solution? - No => Supporting sub-domain
slide-61
SLIDE 61 vladikk Active Record Service / Application Layer Presentation Infrastructure
slide-62
SLIDE 62 vladikk Sales Commissions Reports Let’s try different percentages What if the percentage could be a function
  • f a price?
No, what if the percentage is a function of number of sales? No, no, the percentage will be a function both of number of sales and sale amount And another upgrade if there are more than Y sales per week! But we will upgrade the percentage if there are more than X sales per month!
slide-63
SLIDE 63 vladikk Active Record Service / Application Layer Presentation Infrastructure BIG BALL OF MUD
slide-64
SLIDE 64 vladikk Event Sourced Domain Model Service / Application Layer Presentation Infrastructure BIG BALL OF MUD
slide-65
SLIDE 65 vladikk Active Record Service / Application Layer Presentation Infrastructure Transaction Script Service / Application Layer Presentation Infrastructure Event Crunchers Bonuses Ubiquitous Language
slide-66
SLIDE 66 vladikk Ubiquitous Language Core Bounded Contexts Protect by
 decomposing to Identify Domains Domain Model Supporting Generic AR / TS Adopt Implement as
slide-67
SLIDE 67 vladikk

THE MARKETING HUB BOUNDED CONTEXT

05

slide-68
SLIDE 68 vladikk Leads Marketing Hub Client Client Client
slide-69
SLIDE 69 vladikk Competitive advantage? - Yes => Core Domain
slide-70
SLIDE 70 vladikk Event Sourced Domain Model CQRS Microservices
slide-71
SLIDE 71 vladikk Micro
 Service Micro
 Service Micro
 Service Micro
 Service
slide-72
SLIDE 72 vladikk Aggregate Aggregate Aggregate Aggregate
slide-73
SLIDE 73 vladikk Aggregate Aggregate Aggregate Aggregate Event Sourced
 Aggregate
slide-74
SLIDE 74 vladikk Aggregate Aggregate Aggregate Aggregate Event Sourced
 Aggregate
slide-75
SLIDE 75 vladikk Event Sourced Domain Model CQRS Microservices
slide-76
SLIDE 76 vladikk Aggregate Aggregate Aggregate Aggregate Event Sourced
 Aggregate
slide-77
SLIDE 77 vladikk

TECHNICAL COMPLEXITY BUSINESS COMPLEXITY

>

slide-78
SLIDE 78 vladikk Aggregate Aggregate Aggregate Aggregate Event Sourced
 Aggregate
slide-79
SLIDE 79 Marketing Bonuses U D CRM U D Marketing
 Hub U U D D Event Crunchers U D U D
slide-80
SLIDE 80

WHAT
 WE HAVE L E A R N E D

slide-81
SLIDE 81 vladikk

UBIQUITOUS

LANGUAGE

01

slide-82
SLIDE 82 vladikk

UBIQUITOUS LANGUAGE

THE CORE DOMAIN OF DOMAIN-DRIVEN DESIGN

slide-83
SLIDE 83 vladikk

Marketing

Ubiquitous Language Business goals achieved

CRM

Ubiquitous Language Production issues Long and painful refactoring

Event Crunchers

Ubiquitous Language Big ball of mud

Bonuses

Ubiquitous Language Refactored in time
slide-84
SLIDE 84 vladikk

Invest in the Ubiquitous Language early on

slide-85
SLIDE 85 vladikk

Marketing

Ubiquitous Language Business goals achieved

CRM

Ubiquitous Language Production issues Long and painful refactoring

Event Crunchers

Ubiquitous Language Big ball of mud

Bonuses

Ubiquitous Language Refactored in time
slide-86
SLIDE 86 vladikk

Cheap!

slide-87
SLIDE 87 vladikk

DOMAIN

TYPES

02

slide-88
SLIDE 88 vladikk

Core Supporting Generic

slide-89
SLIDE 89 vladikk Generic Domain Adopt / Buy Supporting Domain Active Record / Transaction Script Core Domain Domain Model / Event Sourcing
slide-90
SLIDE 90 vladikk

COMPANIES CHANGE, EVOLVE, REINVENT THEMSELVES

DOMAINS' TYPES CHANGE ACCORDINGLY

slide-91
SLIDE 91 vladikk

SUPPORTING ➤ CORE

  • Event Crunchers
  • Bonuses

SUPPORTING ➤ GENERIC

  • Creative Catalog

CORE ➤ GENERIC

  • Lead Evaluation System

CORE ➤ SUPPORTING

  • Marketing Hub

GENERIC ➤ CORE

  • AWS
slide-92
SLIDE 92 vladikk Generic Domain Adopt / Buy Supporting Domain Active Record / Transaction Script Core Domain Domain Model / Event Sourcing
slide-93
SLIDE 93 vladikk Generic Domain Adopt / Buy Supporting Domain Active Record / Transaction Script Core Domain Domain Model / Event Sourcing
slide-94
SLIDE 94 vladikk

Less waste Dialog with the business

IMPLEMENTATION DESIGN ➤ DOMAIN TYPE

slide-95
SLIDE 95 vladikk
  • Questionable competitive edge?
  • Accidental “business” complexity?
  • Unexpected competitive edge?

BUSINESS COMPLEXITY ≠ DOMAIN TYPE?

slide-96
SLIDE 96 vladikk Generic Domain Adopt / Buy Supporting Domain Active Record / Transaction Script Core Domain Domain Model / Event Sourcing

IMPLEMENTATION DESIGN ➤ DOMAIN TYPE

slide-97
SLIDE 97 vladikk

IMPLEMENTATION

STRATEGIES

03

slide-98
SLIDE 98 vladikk

How to Model the Business Logic?

slide-99
SLIDE 99 vladikk

How to Model the Business Logic?

Transaction Script (PoEAA) Active Record (PoEAA) Domain Model (PoEAA + DDD) Event Sourced Domain Model
slide-100
SLIDE 100 vladikk

MONEY? DEEP ANALYTICS? AUDIT LOG?

Event Sourced Domain Model

COMPLEX BUSINESS LOGIC?

Domain Model

COMPLEX DATA STRUCTURES?

Active Record

SIMPLE LOGIC, SIMPLE DATA STRUCTURES?

Transaction Script
slide-101
SLIDE 101 vladikk

MAPPING ARCHITECTURAL PATTERNS

Event Sourced Domain Model ➤ CQRS Domain Model ➤ Hexagonal Architecture Active Record ➤ Layered Architecture Transaction Script ➤ “Keep it simple” Architecture
slide-102
SLIDE 102 vladikk

MAPPING ARCHITECTURAL PATTERNS

Event Sourced Domain Model ➤ CQRS Domain Model ➤ Hexagonal Architecture Active Record ➤ Layered Architecture Transaction Script ➤ “Keep it simple” Architecture
slide-103
SLIDE 103 vladikk Transaction Script Active Record Domain Model Event Sourced Domain Model
slide-104
SLIDE 104 vladikk

PAIN?

BUSINESS CHANGED? DOMAIN TYPE CHANGED? REVISE IMPLEMENTATION STRATEGY?

slide-105
SLIDE 105 vladikk Transaction Script Active Record Domain Model Event Sourced Domain Model
slide-106
SLIDE 106 vladikk

CQRS

04

slide-107
SLIDE 107 vladikk

Event Sourcing ➤ CQRS

slide-108
SLIDE 108 vladikk

EVENT SOURCING BUSINESS DOMAIN MODELING PATTERN CQRS ARCHITECTURAL PATTERN FOR REPRESENTING DATA IN DIFFERENT PERSISTENT MODELS

slide-109
SLIDE 109 vladikk Transaction Script Active Record Domain Model } Can benefit from CQRS and State-Based Projections
slide-110
SLIDE 110 vladikk RDBMS Search index Files
 storage Projection
 Engine Projected
 Model Projected
 Model Changes Application Query Query Commit
slide-111
SLIDE 111 vladikk

COMMAND QUERY 
 RESPONSIBILITY SEGREGATION?

slide-112
SLIDE 112 vladikk Did command succeed or fail? If failed - why? What are the outcomes? } Can be delivered asynchronously through queries … but why?
slide-113
SLIDE 113 vladikk Write
 Model Projection Projection Projection
 Engine Projected
 Model Projected
 Model Changes Application Client Command
 Execution Result Query
slide-114
SLIDE 114 vladikk

05

BOUNDED

CONTEXTS

slide-115
SLIDE 115 vladikk Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Placement Visit Lead Campaign Marketing Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Brand Lead Campaign CRM

LINGUISTIC BOUNDARIES

slide-116
SLIDE 116 vladikk Bonuses Event Crunchers

DOMAIN-BASED BOUNDARIES

slide-117
SLIDE 117 vladikk

AGGREGATE-BASED BOUNDARIES

Aggregate Aggregate Aggregate Aggregate
slide-118
SLIDE 118 vladikk

L e a d

SUICIDAL BOUNDARIES

slide-119
SLIDE 119 vladikk
slide-120
SLIDE 120 vladikk

BOUNDED CONTEXTS ARE NOT MICROSERVICES

slide-121
SLIDE 121 vladikk

BOUNDED CONTEXTS PROTECT INTEGRITY OF A UBIQUITOUS LANGUAGE

slide-122
SLIDE 122 vladikk Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Group Desk Qualification Assessment Organization Unit Assignment Rank Message On-site Activity Placement Visit Brand Marketing Lead CRM Lead Marketing Campaign CRM Campaign
slide-123
SLIDE 123 vladikk

MICROSERVICES DECOMPOSITION OF A SYSTEM INTO LOOSELY COUPLED COMPONENTS BOUNDED CONTEXTS PROTECT INTEGRITY OF A UBIQUITOUS LANGUAGE

slide-124
SLIDE 124 vladikk Micro
 Service Micro
 Service Micro
 Service Micro
 Service
slide-125
SLIDE 125

Finding service boundaries is really damn hard… There is no flowchart!

Udi Dahan

slide-126
SLIDE 126 vladikk

THERE ARE GOING TO BE MISTAKES ACCEPT IT AND DON’T MAKE FATAL ONES

slide-127
SLIDE 127 vladikk

THE LESS YOU KNOW ABOUT THE DOMAIN THE WIDER THE INITIAL BOUNDARIES START WITH BIGGER BOUNDARIES DECOMPOSE LATER, AS YOU GAIN KNOWLEDGE

slide-128
SLIDE 128 vladikk Aggregate Aggregate Aggregate Aggregate Event Sourced
 Aggregate
slide-129
SLIDE 129 vladikk Marketing Creative Agency Publisher Website Advertiser Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience Placement Visit Lead Campaign
slide-130
SLIDE 130 vladikk Campaigns Creative Ad Type Agency Publisher Website Zone Type Contract Budget Unit Impression Visit Lead Advertiser Target Market Funnel Audience Placement Campaign Creative Catalog Publishers Events
slide-131
SLIDE 131 vladikk

START WITH BIGGER BOUNDARIES DECOMPOSE AS YOU GAIN DOMAIN KNOWLEDGE

slide-132
SLIDE 132 vladikk
  • 1. Ubiquitous Language is not optional
  • 2. Domain Types change. Embrace these changes to achieve resilient design
  • 3. Learn the ins and outs of the four patterns of modeling business logic
  • 4. Use CQRS to represent the same data in multiple models
  • 5. Bounded Contexts are not Microservices. Always start with bigger
boundaries, but decompose further as you gain domain knowledge
slide-133
SLIDE 133 vladikk

SUMMARY

slide-134
SLIDE 134 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
slide-135
SLIDE 135 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
slide-136
SLIDE 136 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
slide-137
SLIDE 137 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
slide-138
SLIDE 138 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
slide-139
SLIDE 139 vladikk

Creative Agency Advertiser

Publisher Website Placement Ad Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit

Campaign

Aggregates everywhere!!!

slide-140
SLIDE 140 vladikk Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business

Ubiquitous Language Everywhere!!!

slide-141
SLIDE 141 vladikk

P.S.

slide-142
SLIDE 142 vladikk
slide-143
SLIDE 143

THANK YOU!

@vladikk vladikk.com