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

How a deeper software model enables breakthrou...

How a deeper software model enables breakthroughs in product development @ 4DotNet Meetup

Most products start with an initial software model, a model that is usually naive and superficial, based on shallow knowledge. Which makes sense, because you just started discovering and exploring that new product. So we typically start by identifying nouns and verbs and using these as the initial objects and methods to build in our code. While the initial model helps you start getting fast feedback for your product, once you get more feedback most of the time it isn’t a helpful model anymore. They usually don’t provide a rational expression of the primary concerns of the domain experts anymore as time progresses to build that product. Not having that expression can hold you back from making essential breakthroughs for your product, breakthroughs that can be the differentiation factor in the market. And even worse, implementing the model in code might not even support making these new breakthroughs.

Join us in this talk, where we present to you why we think it is crucial for the core model of your product to be continuously refactored towards a deeper model. We begin with a short introduction and the origin of Domain-Driven Design and model-driven design. Then we will explain the concepts of deep modelling, and why tactical patterns with a Supple design are essential to doing deep modelling. We will dive into a concrete example, worked out with the model exploration whirlpool and collaborative modelling practices like EventStorming, Example Mapping, and Responsibility mapping based on CRC cards. Finally, we dive into the code and show how we can get breakthroughs by continuously refactoring to deeper insights with a supple design getting a deep model.

Kenny Baas-Schwegler

September 29, 2023
Tweet

More Decks by Kenny Baas-Schwegler

Other Decks in Programming

Transcript

  1. @brunoboucard How a deeper software model enables breakthroughs in product

    development Moving Beyond Naive Domain Models: Refactoring Towards Deeper Insights Using Domain-​ Driven Design @kenny_baas @[email protected]
  2. @brunoboucard @kenny_baas @[email protected] The DDD Starter Modelling Process - Maxime

    Sanglan-Cha… YouTube Visual and Collaborative Modelling - Kenny Baas-Schwegle… YouTube https://github.com/ddd-​ crew/ddd-​ starter-​ modelling-​ process
  3. Allocate places Reservation system places are allocated Movie screening Time-​

    out policy (15 min) Cancel allocated places Reservation system Allocated placements are canceled - Reserved places - Free places - Reservation Time-​ out Confirm allocation Website Allocation confirmed Movie visitor No Available places found Change seats policy Change allocation Reservation system Change Allocation App Change of allocation requested Allocation is changed - Reserved places - Free places - Reservation Time-​ out Movie visitor Snapshot of Process modelling This can flood the system, disengaging other people who see it is full Movie visitor Place Allocation 1 Number of tickets Requests App On the Allocated places Requesting Reservations to Creates 2 3 Status of places Tells To placement map Shows To 4 5 payment options App Request tickets Number of tickets requested Movie visitor Allocation policy This can flood the system, disengaging other people who see it is full Confirm allocation Tells to On Payment options Shows To 6 7 Snapshot of Use case: Reserving tickets for a theater The Problem! 80% fill rate @brunoboucard @kenny_baas @[email protected]
  4. Seating place Suggestions @brunoboucard Legend Domain Event Information / Read

    Model Command / Action Policy External System Hotspot Invoked On Issues a Activates a Produces an Results in one or more actor Decides to O bserves Constraint Customer - Suggest 3 availabilities per pricing category Suggestion process - Suggestions is made - Only Suggest available seats - Suggest only adjacent seating - Offer seats that are nearer to the stage Suggestions Accepts suggestion Ask for new suggestion Website Website Suggestion is accepted reserve accepted suggestions Reserve seats Reservation system No Available allocation Found Make a new suggestion provide current reservations Reservation system Current Reservation provided Match Reservations with the layout and make suggestions Provide auditorium layout Auditorium layout Auditorium layout provided Seats Suggestions requested Make Suggestions Seats are allocated Time-​ out policy of 15 min Free up allocation Reservation system allocation is freed up - Reserved seats - Free seats - Reservation Time-​ out Confirm allocation Customer Change seats policy Change allocation Reservation system Change allocation Website allocation is changed allocation is changed - Reserved seats - Free seats - Reservation Time-​ out Customer We start with giving everyone the best suggestion. From there we can optimise and spread out the suggestions process/software Design @kenny_baas @[email protected]
  5. Seating place Suggestions By analysing seat quality, viewer preferences, and

    theatre layout, it suggests optimal seating choices for theatre visitor. This not only maximizes the viewing experience but also aids in efficient seat management and capacity optimization. @brunoboucard APP make suggestion Suggestions is Made Suggestions are Not Available APP Reservations Reservations Auditorium Layout Auditorium layout Auditorium Seating Pricing Category Row Seating place Only suggest available places Make 3 suggestions per pricing category Offer seats nearer to the stage Offer seats nearer to the middle of the row Only suggest adjacent seating on a row Avoid leaving single seatings between suggestions and reservations People only want to make reservations when sitting together Amount of new suggestions requested make new suggestion How to optimise between suggestions of different people. @kenny_baas @[email protected]
  6. Legend Rule Example Only Suggest available seats Given Red are

    ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 ask to Make Suggestions Then No suggestions are found Suggest only adjacent seating Offer seats that are nearer to the stage offer seats nearer the middle of a row avoid leaving single seats unbooked on a row, only when there is no other option Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then No suggestions are found Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested Example Mapping @brunoboucard A B C Question Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 When a party of 4 ask to Make Suggestions Then green is suggested Given Red are ReservedSeats A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 ask to Make Suggestions Then green is suggested In the future we might split parties of over 6, preferred on the same row @kenny_baas @[email protected]
  7. SeatAllocator Suggests 3 Seat Suggestion per pricing category AuditoriumSeating IAdaptAuditoriumSeating

    PricingCategory Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating AuditoriumSeating Allocate Seats Knows its unique ID Knows if no adjacent seating's are found Suggest seats nearer to the stage Row Purpose: Can suggests Seats per pricing category make Suggestions Suggestions is Made Suggestions are Not Available Suggest 3 availabilities per pricing category Offer seats that are nearer to the stage @brunoboucard In the future we might split parties of over 6, preferred on the same row avoid leaving single seats unbooked on a row, only when there is no other option Suggest only adjacent seating offer seats nearer the middle of a row Only Suggest available seats Reservations Auditorium Layout SeatAllocator Suggest 3 availabilities per pricing category AuditoriumSeating Flipped Purpose: Make sure to suggest 3 availabilities per pricing category What it knows What it does Responsilbities Collaborators Candidate Name CRC cards modelling Seat allocator Purpose? When we shape an object's responsibilities, we are inventing a form that should fit smoothly into its environment. We have the luxury of shaping both form and context when we distribute responsibilities among collaborators. @kenny_baas @[email protected]
  8. Purpose: Know if they can be suggested PricingCategory First Second

    Third SeatAllocator Suggests 3 Seat Suggestion per pricing category AuditoriumSeating IAdaptAuditoriumSeating PricingCategory Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating AuditoriumSeating Allocate Seats Knows its unique ID Knows if no adjacent seating's are found Suggest seats nearer to the stage Row Purpose: Can suggests Seats per pricing category Row Allocate seats in row Make sure allocation in adjacent Make sure there are no orphan seats knows the row name knows the amount of free seats Suggest seats towards the middle of the row SeatingPlaceAvailability Purpose: Knows the layout of a row of seats Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not SeatingPlaceAvailability Pricingcategory make Suggestions Suggestions is Made SeatingPlaceAvailability Reserved available Allocated Suggestions are Not Available Suggest 3 availabilities per pricing category Offer seats that are nearer to the stage In the future we might split parties of over 6, preferred on the same row avoid leaving single seats unbooked on a row, only when there is no other option Suggest only adjacent seating offer seats nearer the middle of a row Only Suggest available seats @brunoboucard Reservations Auditorium Layout @kenny_baas @[email protected]
  9. Purpose: Know if they can be suggested PricingCategory First Second

    Third SeatAllocator Suggests 3 Seat Suggestion per pricing category AuditoriumSeating IAdaptAuditoriumSeating PricingCategory Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating AuditoriumSeating Allocate Seats Knows its unique ID Knows if no adjacent seating's are found Suggest seats nearer to the stage Row Purpose: Can suggests Seats per pricing category IAdaptAuditoriumSeating Stores and finds AuditoriumSeating Purpose: Adapts auditorium seating to its last known state. Row Allocate seats in row Make sure allocation in adjacent Make sure there are no orphan seats knows the row name knows the amount of free seats Suggest seats towards the middle of the row SeatingPlaceAvailability Purpose: Knows the layout of a row of seats Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not SeatingPlaceAvailability Pricingcategory make Suggestions Suggestions is Made SeatingPlaceAvailability Reserved available Allocated Suggestions are Not Available Suggest 3 availabilities per pricing category Offer seats that are nearer to the stage avoid leaving single seats unbooked on a row, only when there is no other option Suggest only adjacent seating offer seats nearer the middle of a row Only Suggest available seats Reservations Auditorium Layout Reservations Auditorium Layout @brunoboucard In the future we might split parties of over 6, preferred on the same row @kenny_baas @[email protected]
  10. Suggest mixed pricing categories @brunoboucard New insights and requirements Cat

    1 Cat 2 Cat 3 Suggest next to the 3 pricing categories also 3 times a mixed category. If the seating place were already suggested for the other pricing categories, we can also suggest these in the mixed. Mixed Pricing Category Suggestions Legenda Suggested seating placement in other pricing category suggestion @kenny_baas @[email protected]
  11. @brunoboucard Platonic Domain model thinking assumes idealized, abstract representations of

    reality which may not always capture the intricacies of a domain. This can be misleading in Domain-​ Driven Design (DDD), especially in core or complicated supporting domains where the nuances matter. A naïve model, influenced by this thinking, can confine you to an oversimplified view, potentially leading to incorrect, suboptimal and unadaptable software solutions. Inspired by Barry M O'Reilly - Plato is the devil Platonic Domain Model Thinking Anti-​ Pattern @kenny_baas @[email protected]
  12. Introduce a Supple Design in the code to make the

    domain model be adaptable to domain changes Introduce the concept of a Deep Model in the code to express the concerns of our core domain into our code. What we will do about it? @brunoboucard @kenny_baas @[email protected]
  13. @brunoboucard offer seats nearer the middle of a row Introduce

    the concept of a Deep Model in the code Cat 1 Cat 2 Mixed Pricing Category Suggestions Legenda Suggested seating placement in other pricing category suggestion Cat 1 Cat 2 Auditorium Seating Row SeatingPlace Number 1  ​   ​ 2  ​ 3  ​ 4  ​ 5  ​ 6  ​ 7   ​ 8   ​ 9  ​ 10 Number 1  ​   ​ 2  ​ 3  ​ 4  ​ 5  ​ 6  ​ 7   ​ 8   ​ 9  ​ 10 11 @kenny_baas @[email protected] Distance 4  ​   ​ 3  ​ 2  ​ 1  ​ 0  ​ 0  ​ 1   ​ 2   ​ 3  ​ 4
  14. @brunoboucard @kenny_baas @[email protected] Row Allocate seats in row Make sure

    allocation in adjacent Make sure there are no orphan seats knows the row name knows the amount of free seats Suggest seats towards the middle of the row SeatingPlaceAvailability Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not Distance from the middle of the row SeatingPlaceAvailability Pricingcategory
  15. @brunoboucard @kenny_baas @[email protected] Row Allocate seats in row Make sure

    allocation in adjacent Make sure there are no orphan seats knows the row name knows the amount of free seats Suggest seats towards the middle of the row SeatingPlaceAvailability Seating place with distance Distance from the middle of the row SeatingPlace Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not SeatingPlaceAvailability Pricingcategory
  16. @brunoboucard Start implementation in your unit test Make your domain

    concepts explicit Heuristics Your code should be explainable on a whiteboard with stakeholders Deep modelling @kenny_baas @[email protected] https://github.com/ddd-​ crew/ddd-​ starter-​ modelling-​ process
  17. @brunoboucard “The vital detail about the design is captured in

    the code. A well-​ written implementation should be transparent, revealing the model underlying it.” - Eric Evans add value objects Use closure of operations Start implementation in your unit test Make your domain concepts explicit Supple design Deep model Your code should be explainable on a whiteboard with stakeholders @kenny_baas @[email protected]
  18. Deeper domain concepts, when made explicit in code, enhance developer

    awareness of core domain concerns. Naïve, platonic models can obscure these concepts, leading to a mismatch between developer understanding and business problems. Misalignment between exploratory models (with domain experts) and domain models in code hinders effective collaboration. Breakthroughs can be restricted if code is anchored to a naïve model due to tight coupling with deeper domain concepts. @brunoboucard @brunoboucard How a deeper software model enables breakthroughs in product development @kenny_baas @[email protected] https://github.com/ddd-​ crew/ddd-​ starter-​ modelling-​ process
  19. @brunoboucard Independent software consultant, tech lead, and software architect, I

    catalyze organizations and teams towards designing and building sustainable and resilient software architectures https://weave-​ it.org @kenny_baas @[email protected] Bruno leads 42 skillz, which aims to help organizations make software work differently. He offers training, coaching, and advice on TDD, BDD, DDD legacy code refactoring with an extra soul. https://42skillz.com @brunoboucard .linkedin.com/brunoboucard/