Upgrade to Pro — share decks privately, control downloads, hide ads and more …

7 Years of DDD: Tackling Complexity in Marketing Systems

7 Years of DDD: Tackling Complexity in Marketing Systems

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.

Vladik Khononov

February 01, 2018
Tweet

More Decks by Vladik Khononov

Other Decks in Programming

Transcript

  1. Aggregates everywhere!!! Creative Agency Advertiser Publisher Website Placement Ad Zone

    Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Campaign
  2. The Bounded Context Creative Agency Advertiser Publisher Website Placement Ad

    Zone Ad Type Target Market Group Zone Type Funnel Contract Budget Unit Audience
  3. 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
  4. 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
  5. 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
  6. Aggregates will:
 • Protect transactional boundaries
 • Encompass business logic

    and invariants Domain Service / Application Layer Presentation Infrastructure
  7. Aggregates will:
 • Protect transactional boundaries
 • Encompass business logic

    and invariants Domain Service / Application Layer Presentation Infrastructure Domain Service / Application Layer
  8. 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!
  9. Active Record Service / Application Layer Presentation Infrastructure Transaction Script

    Service / Application Layer Presentation Infrastructure Event Crunchers Bonuses
  10. Active Record Service / Application Layer Presentation Infrastructure Transaction Script

    Service / Application Layer Presentation Infrastructure Event Crunchers Bonuses Ubiquitous Language
  11. Event Sourced Domain Model Service / Application Layer Presentation Infrastructure

    Event Sourced Domain Model Service / Application Layer Presentation Infrastructure Event Crunchers Bonuses Ubiquitous Language
  12. Ubiquitous Language Core Bounded Contexts Protect by
 decomposing to Identify

    Domains Domain Model Supporting Generic AR / TS Adopt Implement as
  13. Marketing Bonuses U D CRM U D Marketing
 Hub U

    U D D Event Crunchers U D U D
  14. 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
  15. Generic Domain Adopt / Buy Supporting Domain Active Record /

    Transaction Script Core Domain Domain Model / Event Sourcing
  16. SUPPORTING ➤ CORE • Event Crunchers • Bonuses SUPPORTING ➤

    GENERIC • Creative Catalog CORE ➤ GENERIC • Lead Evaluation System CORE ➤ SUPPORTING • Marketing Hub GENERIC ➤ CORE • AWS
  17. Generic Domain Adopt / Buy Supporting Domain Active Record /

    Transaction Script Core Domain Domain Model / Event Sourcing
  18. Generic Domain Adopt / Buy Supporting Domain Active Record /

    Transaction Script Core Domain Domain Model / Event Sourcing
  19. Generic Domain Adopt / Buy Supporting Domain Active Record /

    Transaction Script Core Domain Domain Model / Event Sourcing IMPLEMENTATION DESIGN ➤ DOMAIN TYPE
  20. 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
  21. MAPPING ARCHITECTURAL PATTERNS Event Sourced Domain Model ➤ CQRS Domain

    Model ➤ Hexagonal Architecture Active Record ➤ Layered Architecture Transaction Script ➤ “Keep it simple” Architecture
  22. MAPPING ARCHITECTURAL PATTERNS Event Sourced Domain Model ➤ CQRS Domain

    Model ➤ Hexagonal Architecture Active Record ➤ Layered Architecture Transaction Script ➤ “Keep it simple” Architecture
  23. EVENT SOURCING A WAY OF MODELING BUSINESS DOMAINS CQRS ARCHITECTURAL

    PATTERN FOR REPRESENTING THE SAME DATA IN DIFFERENT MODELS
  24. 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
  25. Marketing Creative Agency Publisher Website Advertiser Ad Zone Ad Type

    Target Market Group Zone Type Funnel Contract Budget Unit Audience Placement Visit Lead Campaign
  26. 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
  27. 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
  28. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
  29. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
  30. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
  31. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
  32. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business
  33. Creative Agency Advertiser Publisher Website Placement Ad Zone Ad Type

    Target Market Group Zone Type Funnel Contract Budget Unit Campaign Aggregates everywhere!!!
  34. Ubiquitous Language Bounded Contexts Protect by
 decomposing to Design
 Implementation

    Core Supporting Generic Domain Model AR / TS Adopt Confirm w/
 Business Ubiquitous Language Everywhere!!!