Turns out Domain-Driven Design works not only for cargo shipping. I’d like to share the story of Plexop. Plexop is a large-scale marketing system that spans dozens of different business domains, from management of ad spaces to sellers’ commissions. To implement Plexop we had little resources and a very short time to market. That’s why we embraced DDD from day one, and boy did it pay out. I'll show how DDD allowed us to tackle complexities, talk on strategies for defining service boundaries that we tried, and of course, the things that we had to learn the hard way - by making our own mistakes.
43. 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 CRM Campaign
48. 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 CRM Campaign
49. 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
50. Aggregates will:
• Protect transactional boundaries
• Encompass business logic and invariants
Domain
Service / Application Layer
Presentation
Infrastructure
51. Aggregates will:
• Protect transactional boundaries
• Encompass business logic and invariants
Domain
Service / Application Layer
Presentation
Infrastructure
Domain
Service / Application Layer
80. 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!
82. Event Sourced Domain Model
Service / Application Layer
Presentation
Infrastructure
BIG BALL OF MUD
83. Active Record
Service / Application Layer
Presentation
Infrastructure
Transaction Script
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
84. Active Record
Service / Application Layer
Presentation
Infrastructure
Transaction Script
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
UbiquitousLanguage
85. Event Sourced Domain Model
Service / Application Layer
Presentation
Infrastructure
Event Sourced Domain Model
Service / Application Layer
Presentation
Infrastructure
Event Crunchers Bonuses
UbiquitousLanguage
106. Marketing
Ubiquitous Language
Business goals achieved
CRM
Ubiquitous Language
Production issues
Long and painful refactoring
Event Crunchers
Ubiquitous Language
Big ball of mud
107. 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
109. 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
130. MONEY? DEEP ANALYTICS? AUDIT LOG?
Event Sourced Domain Model
COMPLEX BUSINESS LOGIC?
Domain Model
131. MONEY? DEEP ANALYTICS? AUDIT LOG?
Event Sourced Domain Model
COMPLEX BUSINESS LOGIC?
Domain Model
COMPLEX DATA STRUCTURES?
Active Record
132. 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
139. 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
153. 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. Start with bigger boundaries, and divide as you gain domain knowledge