Turns out Domain-Driven Design works not only for cargo shipping, but for marketing systems as well. In this session I’d like to share the story of Plexop - a large-scale marketing system that spans over a dozen of different business domains: from optimizing advertising spaces, to managing sales agents’ commissions. Plexop had to be implemented with tight resources, and even tighter time to market. That’s why we embraced Domain-Driven Design from day one, and boy did it pay out. I’ll show how DDD allowed us deliver Plexop on time and on budget: what worked, what didn’t, what we had to learn ourselves, and the prices we paid when tried to cut corners.
29. 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
34. 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
35. 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
36. Aggregates will:
• Protect transactional boundaries
• Encompass business logic and invariants
Domain
Service / Application Layer
Presentation
Infrastructure
37. Aggregates will:
• Protect transactional boundaries
• Encompass business logic and invariants
Domain
Service / Application Layer
Presentation
Infrastructure
Domain
Service / Application Layer
64. Sales Commissions Reports
Let’s try different percentages
What if the percentage could be a function of
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!
66. Active Record
Service / Application Layer
Presentation
Infrastructure
Transaction Script
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
67. Active Record
Service / Application Layer
Presentation
Infrastructure
Transaction Script
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
UbiquitousLanguage
68. Event Sourced Domain Model
Service / Application Layer
Presentation
Infrastructure
Event Sourced Domain Model
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
UbiquitousLanguage
87. 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
102. How to Model the Business Logic?
Transaction Script
Active Record
Domain Model
Event Sourced Domain Model
103. 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
104. MAPPING ARCHITECTURAL PATTERNS
Event Sourced Domain Model ➤ CQRS
Domain Model ➤ Hexagonal Architecture
Active Record ➤ Layered Architecture
Transaction Script ➤ “Keep it simple” Architecture
105. MAPPING ARCHITECTURAL PATTERNS
Event Sourced Domain Model ➤ CQRS
Domain Model ➤ Hexagonal Architecture
Active Record ➤ Layered Architecture
Transaction Script ➤ “Keep it simple” Architecture
114. 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
126. START WITH BIGGER BOUNDARIES
DECOMPOSE AS YOU GAIN DOMAIN KNOWLEDGE
127. 1. Ubiquitous Language is not optional
2. Domain Types change. Embrace these changes
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. Start with bigger boundaries, and divide as you gain domain knowledge