$30 off During Our Annual Pro Sale. View Details »

DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition

Two of the six modules of the @DDDBE meetup on Strategic Domain-Driven Design on June 10, 2014 at Stack & Heap

1. Bounded Contexts
2. Modelling

More at http://verraes.net/ or http://twitter.com/mathiasverraes

Mathias Verraes

June 10, 2014
Tweet

More Decks by Mathias Verraes

Other Decks in Technology

Transcript

  1. DDD Basics - Kortrijk Edition
    June 10, 2014 - Belgium
    @DDDBE — http://domaindriven.be

    View Slide

  2. Kindly hosted by

    View Slide

  3. We’ve got some great
    (international) speakers,
    but we need locations!
    ping
    @DDDBE
    http://domaindriven.be

    View Slide

  4. Aspects of
    Domain-Driven Design

    View Slide

  5. Tactical DDD
    !
    design patterns

    View Slide

  6. Collaborative DDD
    !
    model storming

    View Slide

  7. Strategic DDD
    !
    complexity, scale

    View Slide

  8. Defining DDD (Yves)
    Ubiquitous Language (Jef)
    Bounded Contexts (Mathias)
    Context Mapping (Stijn)
    Modelling (Mathias)
    Starting/Selling DDD (Tom)
    Q&A / Lean Coffee

    View Slide

  9. Bounded Contexts

    View Slide

  10. “When something
    is wrong,
    something is
    too big.”
    — Leopold Kohr

    View Slide

  11. Large complex systems:
    harder to reason about

    View Slide

  12. Large complex systems:
    your mental model
    !=
    my mental model

    View Slide

  13. Large complex systems:
    subtle nuances
    in meaning

    View Slide

  14. Avoid a big unified
    centralised model.

    View Slide

  15. Classic example:
    What is a product?

    View Slide

  16. Split into
    Bounded Contexts

    View Slide

  17. Make Bounded Context
    explicit
    pure
    independent
    consistent within its
    boundary

    View Slide

  18. Benefits:
    clarity
    model integrity
    freedom to
    evolve separately

    View Slide

  19. Drawbacks:
    short term convenience
    choosing the boundaries
    how big is the problem?

    View Slide

  20. Tricks

    View Slide

  21. Inspired by
    departments
    teams
    life cycles
    business processes

    View Slide

  22. What if this was an
    off-the-shelf solution?

    View Slide

  23. How much
    communication goes on
    between Bounded
    Contexts?

    View Slide

  24. Visualize!
    !
    Context Mapping
    Model Storming

    View Slide

  25. Modelling

    View Slide

  26. Structural modelling
    describes state

    View Slide

  27. Structural modelling
    inspired by
    persistence concerns

    View Slide

  28. Relational
    Normalised
    CRUD
    Anaemic

    View Slide

  29. “CRUD is our
    industry’s
    grand failure.”
    — Greg Young

    View Slide

  30. Ask your Domain Expert
    about
    State Changes!

    View Slide

  31. Why does it change?
    When does it change?
    How often?
    Who causes it?
    By which rules?
    What consequences?

    View Slide

  32. !
    !
    The moving parts are
    more interesting than the
    stable parts

    View Slide

  33. !
    !
    A Domain Model
    is about:

    View Slide

  34. state + structure
    behaviour + change
    temporal
    roles + actors
    business rules + invariants
    causality + correlation
    interaction
    processes
    workflows + transitions
    intention + consequence
    failure …

    View Slide

  35. Modelling:
    Make the implicit explicit

    View Slide

  36. example
    !
    Intentions:
    Command Objects
    Consequences:
    Domain Events

    View Slide

  37. Intention
    Protection
    Interpretation
    Automation
    user sends Commands
    manage processes
    domain model

    sends Events,

    guards consistency
    create read models
    from Events
    DTO
    Commands
    Events

    View Slide

  38. @mathiasverraes
    http://verraes.net

    View Slide