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

Domain Storytelling

Domain Storytelling

Talk on Domain Storytelling

Henning Schwentner

June 29, 2023
Tweet

More Decks by Henning Schwentner

Other Decks in Programming

Transcript

  1. Starring With
    Directed by
    as
    Written by

    View full-size slide

  2. @hschwentner

    View full-size slide

  3. Foto: Rameessos/Wikipedia

    View full-size slide

  4. @hschwentner
    Spark a fire !
    Tell a story "
    Paint a picture #

    View full-size slide

  5. Painting a picture
    "

    View full-size slide

  6. !"#
    Kolleg:in gesucht
    (Deutschlandweit)

    View full-size slide

  7. @hschwentner
    Do I get a car for this?

    View full-size slide

  8. @hschwentner
    To split the Monolith we first
    have to put it aside

    View full-size slide

  9. thinking
    about
    business
    =>
    thinking
    about
    technology
    to

    View full-size slide

  10. customer
    tells wish for
    1
    salesperson
    signs
    to
    gives
    for
    contract
    3
    risk manager
    contract
    passes on
    to
    4
    contract
    votes
    checks
    calculates
    5
    6
    7
    calculates
    to
    8
    2
    car
    credit
    rating
    installment
    car
    resale
    value
    contract

    View full-size slide

  11. @hschwentner
    Explained

    View full-size slide

  12. Collaborative Modeling

    View full-size slide

  13. Domain
    Expert
    Developer

    View full-size slide

  14. Knowledge crunching

    View full-size slide

  15. Collaborative Modeling
    User Story
    Mapping

    View full-size slide

  16. @hschwentner
    Domain Storytelling =
    Pictographic Language +
    Workshop Format

    View full-size slide

  17. @hschwentner
    The Workshop Format

    View full-size slide

  18. @hschwentner
    Bring together
    the right people and
    let them tell a story

    View full-size slide

  19. "
    "
    Storyteller
    Listeners

    View full-size slide

  20. @hschwentner
    HANDS OVER
    RISK MANAGER
    SALESPERSON
    TO
    CONTRACT
    PASSES ON
    “The salesperson passes on
    the contract to the risk
    manager”

    View full-size slide

  21. Active Listening

    View full-size slide

  22. CONCRETE STORIES VS.
    ABSTRACT PROCESSES

    View full-size slide

  23. @hschwentner
    The
    Pictographic
    Language

    View full-size slide

  24. @hschwentner
    actor work object activity
    5
    sequence
    number

    View full-size slide

  25. @hschwentner
    risk
    manager
    contract votes

    View full-size slide

  26. @hschwentner
    CALCULATES
    GIVES
    INSTALLMENT
    CAR

    View full-size slide

  27. @hschwentner
    CONTRACT
    CONTRACT
    PASSES ON
    SIGNS

    View full-size slide

  28. @hschwentner
    person group IT system

    View full-size slide

  29. ACTORS ONCE/
    WORK OBJECTS SEVERAL TIMES
    SIGNS
    4
    FILLS OUT
    5
    CUSTOMER
    CONTRACT
    CONTRACT

    View full-size slide

  30. @hschwentner
    ßDraw here
    Leave some empty space there à
    Annotations,
    variations, and
    purpose
    Precondi?ons,
    assump?ons, and
    triggers
    Name of the Domain Story

    View full-size slide

  31. PICTOGRAPHIC LANGUAGE –
    NO IF/SWITCH/OR
    actor work object activity
    5
    sequence
    number

    View full-size slide

  32. Scenario-based
    modeling

    View full-size slide

  33. Scenarios
    Car Leasing – The Happy Path
    Car Leasing – Contract is too risky
    Car Leasing – Customer can’t afford installment

    View full-size slide

  34. @hschwentner
    Scope

    View full-size slide

  35. Scope Factors

    View full-size slide

  36. @hschwentner
    Granularity
    Point in time
    Domain Purity

    View full-size slide

  37. @hschwentner
    Granularity
    fine-
    grained
    coarse-
    grained
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x
    x

    View full-size slide

  38. @hschwentner
    A Day at the Beach
    ! Sea Level
    " Kite Level
    ☁ Cloud Level
    $ Fish Level
    % Clam Level
    Foto: Dennis Hamilton/flickr/CC BY 2.0
    Alistair
    Cockburn

    View full-size slide

  39. @hschwentner
    Point in Time
    as-is to-be
    t

    View full-size slide

  40. @hschwentner
    Point in Time
    now optimized
    t
    with new
    system

    View full-size slide

  41. @hschwentner
    Domain Purity
    pure digitalized

    View full-size slide

  42. @hschwentner
    Excercise

    View full-size slide

  43. @hschwentner
    Tell domain story:
    - “Travel by train”
    - Coarse-grained
    - All together
    Exercise

    View full-size slide

  44. @hschwentner
    Tools

    View full-size slide

  45. PowerPoint
    Whiteboard Kit (www.domainstorytelling.org)

    View full-size slide

  46. @hschwentner
    https://egon.io

    View full-size slide

  47. PowerPoint
    Whiteboard Kit (www.domainstorytelling.org)

    View full-size slide

  48. Whiteboard Kit (www.domainstorytelling.org)

    View full-size slide

  49. @hschwentner

    View full-size slide

  50. @hschwentner
    Modes

    View full-size slide

  51. @hschwentner
    Tell domain story:
    - “Going to the movies”
    - Coarse-grained
    - In groups
    Exercise

    View full-size slide

  52. @hschwentner
    Purposes

    View full-size slide

  53. @hschwentner
    draw boundaries
    learn language
    work on
    requirements
    implement domain
    model
    find shadow IT …

    View full-size slide

  54. @hschwentner
    Learning Domain Language

    View full-size slide

  55. CUSTOMER
    TELLS WISH FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VOTES
    CHECKS
    CALCULATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    INSTALLMENT:
    THE MONTHLY
    PAYMENT OF
    THE CUSTOMER

    View full-size slide

  56. @hschwentner
    Drawing Boundaries

    View full-size slide

  57. Bundesarchiv, Bild 173-1282 / Helmut J. Wolf / CC-BY-SA 3.0

    View full-size slide

  58. @hschwentner
    Scope:
    coarse-grained
    to-be (i.e. optimized)
    pure

    View full-size slide

  59. Which activities
    belong together
    (from an actor’s
    perspective)?

    View full-size slide

  60. CUSTOMER
    TELLS WISH
    FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VO
    TES
    CHECKS
    CALCU
    LATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    SALES
    RISK ASSESSMENT

    View full-size slide

  61. CUSTOMER
    TELLS WISH
    FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VO
    TES
    CHECKS
    CALCU
    LATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    SALES
    Group the sentences
    • Boundary around activites
    and work objects
    • Keep actors outside
    boundaries
    Give a name to the group
    RISK ASSESSMENT

    View full-size slide

  62. CUSTOMER
    TELLS WISH
    FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VO
    TES
    CHECKS
    CALCU
    LATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    SALES
    RISK ASSESSMENT

    View full-size slide

  63. SALES
    RISK
    ASSESSMENT

    View full-size slide

  64. @hschwentner
    Naming Subdomains
    Express what is done
    Verbs turned into nouns
    Often: -ing-form
    Anti-pattern: name of work object
    as name for subdomain

    View full-size slide

  65. @hschwentner
    Naming Subdomains—
    Examples
    Price
    calculation
    Risk
    assess-
    ment
    Maneuver
    planning
    Customer
    Car
    Price
    Payment
    Car
    inspection

    View full-size slide

  66. Indicators:
    1) Actor produces result on their own
    2) One-way informa3) Different triggers
    (4) Acin the picture
    5) Difference in language
    6) Different use of the same thing
    Ask your
    domain experts!

    View full-size slide

  67. @hschwentner
    Draw Boundaries:
    - “Traveling by train”
    - All together
    Exercise

    View full-size slide

  68. @hschwentner
    Draw Boundaries:
    - “Going to the movies”
    - In groups
    Exercise

    View full-size slide

  69. @hschwentner
    From Coarse-Grained
    to Fine-Grained

    View full-size slide

  70. CUSTOMER
    TELLS WISH
    FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VO
    TES
    CHECKS
    CALCU
    LATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    SALES
    RISK ASSESSMENT

    View full-size slide

  71. CUSTOMER
    TELLS WISH
    FOR
    1
    SALESPERSON
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    CALCU-
    LATES
    TO
    8
    2
    CAR
    INSTALLMENT
    CAR
    CONTRACT
    SALES
    salesperson
    fills out
    1
    contract
    car model
    w
    ith
    price
    and

    View full-size slide

  72. salesperson
    fills out
    1
    2
    interest
    from
    contract
    price
    car model
    calculates
    3
    offers
    installment
    signs
    w
    ith
    and
    contract
    for
    price
    and
    customer
    contract
    3

    View full-size slide

  73. @hschwentner
    Tell domain story:
    - “Validate train ticket”
    - Fine-grained
    - All together
    Exercise

    View full-size slide

  74. @hschwentner
    Tell domain story:
    - “Selling movie tickets”
    - Fine-grained,
    pure, as-is
    - In groups
    Exercise

    View full-size slide

  75. @hschwentner
    Working
    with
    Requirements

    View full-size slide

  76. @hschwentner
    From Domain Story
    to User Story

    View full-size slide

  77. SALESPERSON
    CUSTOMER
    TELLS WISH FOR
    1
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VOTES
    CHECKS
    CALCULATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    TELL WISH
    FOR CAR
    CALCULATE
    INSTALLMENT

    View full-size slide

  78. SALESPERSON
    CUSTOMER
    TELLS WISH FOR
    1
    SIGNS
    TO
    GIVES
    FOR
    CONTRACT
    3
    RISK MANAGER
    CONTRACT
    PASSES ON
    TO
    4
    CONTRACT
    VOTES
    CHECKS
    CALCULATES
    5
    6
    7
    CALCU-
    LATES
    TO
    8
    2
    CAR
    CREDIT
    RATING
    INSTALLMENT
    CAR
    RESALE
    VALUE
    CONTRACT
    AS CUSTOMER I WANT
    TO TELL WHAT KIND
    OF CAR I NEED SO
    THAT THE CAR IS NOT
    TOO EXPENSIVE
    AS SALESPERSON I
    WANT TO CALCULATE
    THE CONTRACT SO
    THAT I CAN FULFILL
    MY CLIENT‘S WISH

    View full-size slide

  79. @hschwentner
    From Domain Story
    to User Story Map

    View full-size slide

  80. @hschwentner
    Coarse-Grained Domain Story
    as
    Backbone for
    User Story Map

    View full-size slide

  81. @hschwentner
    TELL WISH
    FOR CAR
    CALCULATE
    INSTALLMENT
    SIGN
    CONTRACT
    PASS ON
    CONTRACT

    View full-size slide

  82. @hschwentner
    WISH
    CAR
    CALCULATE
    INSTALLMENT
    SIGN
    CONTRACT
    PASS O
    CONTRA
    CALCULATE
    INSTALLMENT
    FOR NEW
    CUSTOMER
    CALCULATE
    INSTALLMENT
    FOR EXISTING
    CUSTOMER

    View full-size slide

  83. @hschwentner
    Write user stories:
    - “Selling movie tickets”
    - In groups
    Exercise

    View full-size slide

  84. @hschwentner
    Modeling in Code

    View full-size slide

  85. salesperson
    fills out
    1
    2
    interest
    from
    contract
    price
    car model
    calculates
    3
    offers
    installment
    signs
    w
    ith
    and
    contract
    for
    price
    and
    customer
    contract
    3

    View full-size slide

  86. @hschwentner
    How do we design a
    program for that?

    View full-size slide

  87. @hschwentner
    #dddesign

    View full-size slide

  88. -DRIVEN DESIGN

    View full-size slide

  89. Software
    Domain

    View full-size slide

  90. @hschwentner
    From Domain Story to Code

    View full-size slide

  91. «Entity»
    Contract
    fillOut(:CarModel, :Price)
    calculateInstallment(:Interest)
    salesperson
    fills out
    1
    2
    interest
    from
    contract
    price
    car model
    calculates
    3
    offers
    installment
    signs
    w
    ith
    and
    contract
    for
    price
    and
    customer
    contract
    3
    sign()

    View full-size slide

  92. «En>ty»
    Contract
    fillOut(:CarModel, :Price)
    calculateInstallment(:Interest)
    sign()
    «Value Object»
    CarModel «Value Object»
    Price
    «Value Object»
    Interest

    View full-size slide

  93. class Contract {
    public Contract(CarModel carModel, Amount price)
    //...
    public void calculateInstallment(Interest interest)
    //...
    public void sign(SignDate date)
    //...
    }

    View full-size slide

  94. import org.jmolecules.annotations.ddd.Entity;
    @Entity
    class Contract {
    public Contract(CarModel carModel, Amount price)
    //...
    public void calculateInstallment(Interest interest)
    //...
    public void sign(SignDate date)
    //...
    }

    View full-size slide

  95. import org.jmolecules.annotations.ddd.Entity;
    @Entity
    class Contract {
    public Contract(CarModel carModel, Amount price)
    //...
    public void calculateInstallment(Interest interest)
    //...
    public void sign(SignDate date)
    //...
    }
    record CarModel(String name){}

    View full-size slide

  96. import org.jmolecules.annotations.ddd.*;
    @Entity
    class Contract {
    public Contract(CarModel carModel, Amount price)
    //...
    public void calculateInstallment(Interest interest)
    //...
    public void sign(SignDate date)
    //...
    }
    @ValueObject
    record CarModel(String name){}

    View full-size slide

  97. @Entity
    class Contract {
    public Contract(CarModel carModel, Amount price)
    //...
    public void calculateInstallment(Interest interest)
    //...
    public void sign(SignDate date)
    //...
    }
    @ValueObject
    record CarModel(String name){}
    @ValueObject
    record Amount(int cents, Currency currency){}
    @ValueObject
    enum Currency{ EUR, GBP, USD }

    View full-size slide

  98. public void sign(SignDate date)
    //...
    }
    @ValueObject
    record CarModel(String name){}
    @ValueObject
    record Amount(int cents, Currency currency){}
    @ValueObject
    enum Currency{ EUR, GBP, USD }
    // ...

    View full-size slide

  99. Object orientation

    View full-size slide

  100. LeasingNinja
    https://leasingninja.io

    View full-size slide

  101. @hschwentner
    LeasingNinja.io

    View full-size slide

  102. @hschwentner
    Derive Domain Model:
    - “Traveling by train”
    - From fine-grained
    stories
    - All together
    Exercise

    View full-size slide

  103. @hschwentner
    Derive Domain Model:
    - “Going to the movies”
    - From fine-grained
    stories
    - In groups
    Exercise

    View full-size slide

  104. @hschwentner
    Cutting the Monolith

    View full-size slide

  105. @hschwentner
    Brownfield

    View full-size slide

  106. @hschwentner
    How to split the monolith

    View full-size slide

  107. 1) How should it be?
    2) How is it?
    3) How to move the “is” to the “ideal”?
    RISK
    MANAGE-
    MENT
    SALES

    View full-size slide

  108. 1) How should it be?
    1) Domain Re-Discovery
    2) “ideal” context map
    2) How is it?
    1) Architecture Analysis
    2) As-is context map
    3) How to move the “is” to the “ideal”?
    1) Compare
    2) Create List of Refactorings
    4) Do the move
    1) Extract a suppor2) Then extract core(s)

    View full-size slide

  109. old old old old
    new
    new new new
    “just flip
    the lever”
    1 2 3 4 5
    a.k.a.
    big bang
    replacement

    View full-size slide

  110. old old old
    new
    new new new
    2 3 4 5
    old
    1

    View full-size slide

  111. Strangler
    Fig
    Application

    View full-size slide

  112. Strangler Fig Application

    View full-size slide

  113. Lesson:
    is better than
    Strangler Fig
    Application
    Big Bang
    Replacement

    View full-size slide

  114. <>
    Contract
    sign()
    SALES
    RISK
    ASSESSMENT
    <>
    Contract
    sign()
    vote()

    BIG BALL
    OF MUD
    <>
    Contract
    vote()

    View full-size slide

  115. Domain-Driven
    Refactorings
    • Strategic
    • Socio-Technical
    • Tactical (Against Model Anemia)
    • Tactical (Against Big Ball of Mud)

    View full-size slide

  116. Domain-Driven
    Refactorings
    • Strategic
    • Carve Out Bounded Context
    • Socio-Technical
    • Form Cross-Functional Team
    • Tactical (Against Model Anemia)
    • Tactical (Against Big Ball of Mud)
    • Extract Specialized Entity
    • Extract Specialized Data Model

    View full-size slide

  117. Read on at:
    https://hschwentner.io/domain-driven-refactorings

    View full-size slide

  118. @hschwentner
    Consulting

    View full-size slide

  119. @hschwentner
    Conclusion

    View full-size slide

  120. @hschwentner
    Further Reading

    View full-size slide

  121. @hschwentner
    https://domainstorytelling.org

    View full-size slide

  122. Get it at:
    https://hschwentner.io

    View full-size slide

  123. @hschwentner
    LeasingNinja.io

    View full-size slide

  124. May 6th-8th 2024
    Vienna, Austria
    The Collaborative Modeling Unconference
    comocamp.org
    Event Storming
    User Story Mapping
    Event Modeling
    Impact Mapping
    Domain Storytelling
    Storystorming
    Context Mapping
    Example Mapping
    etc.

    View full-size slide

  125. @hschwentner

    View full-size slide

  126. Bibliography
    Baas-Schwegler, Kenny and João Rosa (eds.). Visual Collaboration Tools. Self-published, Leanpub, last updated
    August 7, 2020.
    Beck, Kent et al. Manifesto for Agile Software Development. 2001.
    Brandolini, Alberto. Introducing EventStorming. Self-published, Leanpub, last updated February 12, 2021.
    Conway, Melvin E. “How Do Committees Invent?” Datamation 14, no. 5 (April 1968): 28–31.
    Evans, Eric. Domain-Driven Design: Tackling Complexity in the Heart of Software. Boston: Addison-Wesley, 2004.
    Foote, Brian and Joseph Yoder. “Big Ball of Mud.” PLoP ’97, Monticello, IL, September 1997.
    Fowler, Martin. “Strangler Fig Application.” Bliki, June 29, 2004.
    Hofer, Stefan and Henning Schwentner. Domain Storytelling: a Collaborative, Visual, and Agile Way to Develop Domain-
    Driven Software. Boston: Addison-Wesley, 2022.
    Patton, Jeff. User Story Mapping: Discover the Whole Story, Build the Right Product. Sebastopol, CA: O’Reilly, 2014.

    View full-size slide

  127. Henning Schwentner
    ⌂ https://hschwentner.io
    @hschwentner
    [email protected]
    Kolleg:in gesucht
    (Deutschlandweit)

    View full-size slide

  128. @hschwentner
    Appendix

    View full-size slide

  129. @hschwentner
    What about Event Storming?

    View full-size slide