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

apidays Paris 2024 - Modularizing your API with...

apidays
December 22, 2024

apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning Schwentner, Workplace Solutions

Modularizing your API with Domain Storytelling
Henning Schwentner, Coder, Coach, Consultant - WPS at Workplace Solutions

apidays Paris 2024 - The Future API Stack for Mass Innovation
December 3 - 5, 2024

------

Check out our conferences at https://www.apidays.global/

Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8

Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io

Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/

apidays

December 22, 2024
Tweet

More Decks by apidays

Other Decks in Programming

Transcript

  1. !

  2. !

  3. !

  4. 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
  5. @hschwentner HANDS OVER RISK MANAGER SALESPERSON TO CONTRACT PASSES ON

    “The salesperson passes on the contract to the risk manager”
  6. @hschwentner ßDraw here Leave some empty space there à Annotations,

    variations, and purpose Precondi?ons, assump?ons, and triggers Name of the Domain Story
  7. Scenarios Car Leasing – The Happy Path Car Leasing –

    Contract is too risky Car Leasing – Customer can’t afford installment
  8. @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
  9. 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
  10. 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
  11. 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
  12. 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
  13. @hschwentner Naming Subdomains Express what is done Verbs turned into

    nouns Often: -ing-form Anti-pattern: name of work object as name for subdomain
  14. Indicators: 1) Actor produces result on their own 2) One-way

    informa<on flow 3) Different triggers (<me vs. on demand) 4) Ac<vi<es suppor<ng something that is not in the picture 5) Difference in language 6) Different use of the same thing Ask your domain experts!
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. @hschwentner WISH CAR CALCULATE INSTALLMENT SIGN CONTRACT PASS O CONTRA

    CALCULATE INSTALLMENT FOR NEW CUSTOMER CALCULATE INSTALLMENT FOR EXISTING CUSTOMER
  21. 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
  22. «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()
  23. class Contract { public Contract(CarModel carModel, Amount price) //... public

    void calculateInstallment(Interest interest) //... public void sign(SignDate date) //... }
  24. 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) //... }
  25. 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){}
  26. 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){}
  27. @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 }
  28. public void sign(SignDate date) //... } @ValueObject record CarModel(String name){}

    @ValueObject record Amount(int cents, Currency currency){} @ValueObject enum Currency{ EUR, GBP, USD } // ...
  29. @hschwentner Derive Domain Model: - “Traveling by train” - From

    fine-grained stories - All together Exercise
  30. @hschwentner Derive Domain Model: - “Going to the movies” -

    From fine-grained stories - In groups Exercise
  31. 1) How should it be? 2) How is it? 3)

    How to move the “is” to the “ideal”? RISK MANAGE- MENT SALES
  32. 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 suppor<ng domain to learn 2) Then extract core(s)
  33. old old old old new new new new “just flip

    the lever” 1 2 3 4 5 a.k.a. big bang replacement
  34. 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
  35. 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.
  36. 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.