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

Domain-Driven Design

Domain-Driven Design

DDD webinar.

Ivan Paulovich

November 03, 2020
Tweet

More Decks by Ivan Paulovich

Other Decks in Programming

Transcript

  1. Introduction Strategic Design: High Level Design People Interactions Business and

    Dev Collaboration Tactical Design: Low Level Design Source Code Building Blocks in Code
  2. Strategic Design • Bounded Contexts: it is the conceptual boundary

    where terms are unambiguous. • Context Maps: the di f f erent kinds of relationships between Bounded Contexts. • Ubiquitous Language: shared language build by business and development and is expressed in the domain model. @ivanpaulovich
  3. Sales Bounded Context Customer Sales Person Product Support Bounded Context

    Customer Ticket Product Defect Bounded Contexts
  4. Strategic Design • Context Maps • Shared Kernel • Partner

    • Anti Corruption Layer • Customer / Supplier • Conformist @ivanpaulovich Sales Bounded Context Customer Bounded Context Context Map Upstream Downstream
  5. Strategic Design • Context Maps • Shared Kernel • Partner

    • Anti Corruption Layer • Customer / Supplier • Conformist @ivanpaulovich • Shared Kernel requires more collaboration between peers. • Conformist has no collaboration at all. • Anti Corruption Layer builds a fence between the dependencies.
  6. Strategic Design • Context Maps • Shared Kernel • Partner

    • Anti Corruption Layer • Customer / Supplier • Conformist @ivanpaulovich • Shared Kernel boundaries are very light in comparison to Anti Corruption Layer mapping.
  7. DDD is About Learning @ivanpaulovich You can’t just draw all

    the “boundaries” up front. — It will cost you a lot! Bounded Contexts are owned by “one team” that builds its language. Focus on important and core business. Don’t make complex things more complicated than needed.
  8. Tactical Design • Design Patterns and Building Blocks applied within

    a Bounded Context. • Used to enrich the Domain Model. • It is low level design and hands-on.
 • It is the opposite of Anaemic Model! @ivanpaulovich
  9. A Wallet Application Deposit Withdraw Transfer Close Account Open Account

    Database Persistence Exchange Service User Interface Exchange Rates API In Memory SQL In Memory Security @ivanpaulovich
  10. Domain-Driven Design Patterns • Bounded Context • Value Object •

    Entity • Aggregate Root • Repository
 • Use Case • Entity Factory • Domain Service • Application Service @ivanpaulovich https://github.com/ivanpaulovich/clean-architecture-manga/wiki
  11. Virtual Wallet Customer Checking Account Credit Debit Aggregate Root Entity

    Value Object @ivanpaulovich Account Balance Bounded Context
  12. Virtual Wallet Customer Checking Account Credit Debit Openning Date Amount

    Transaction 
 Date Description Amount Transaction 
 Date Description Name Personnummer Mobile Phone 
 Number Aggregate Root Entity Value Object @ivanpaulovich
  13. Virtual Wallet Customer Checking Account Credit Debit Openning Date Amount

    Transaction 
 Date Description Amount Transaction 
 Date Description Name Personnummer Mobile Phone 
 Number Aggregate Root Entity Value Object @ivanpaulovich Customer Bounded Context Balance Bounded Context
  14. Value Object @ivanpaulovich 1. Encapsulate tiny business rules. 2. Immutable

    object. 3. Uniquely identi f i ed by comparison
 of its properties.
  15. Aggregate Root 1. Owns the entities objects graph. 2. Ensures

    the state consistency of 
 children entities. 3. De f i nes the consistency boundary. 4. Highly Abstract. 5. Highly Stable. @ivanpaulovich
  16. Working with Aggregates Aggregate Entity Value Object Value Object Entity

    Value Object Aggregate • Aggregates know each other only by their IDs. • Keep a low coupling between them. @ivanpaulovich