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

Refactoring to a deeper software model enables ...

Refactoring to a deeper software model enables breakthroughs in product development

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 hands-on modelling and coding session focused on the significance of continuously refactoring your product's core domain model. We will introduce you to the context by guiding you through several collaborative modelling techniques such as Eventstorming, Domain Storytelling, Context Mapping, CRC-cards and more. Dive into coding challenges using C# and Java, where you'll witness firsthand the transformative power of supple design and a deeper model. By the end, you'll understand how continuously refactoring the model can be pivotal in driving product development breakthroughs. Whether you prefer pairing or ensemble programming, you'll depart with enriched practical insights and a deeper understanding of chapter 13 from the blue book by Eric Evans.

Kenny Baas-Schwegler

May 17, 2024
Tweet

More Decks by Kenny Baas-Schwegler

Other Decks in Programming

Transcript

  1. @brunoboucard @kenny_baas @[email protected] Talk to the person(s) next to you,

    and have a short conversation why you are here, what programming language you write in and what you know of a deeper software model.
  2. 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]
  3. Seating place Suggestions 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 @brunoboucard @kenny_baas @[email protected]
  4. @brunoboucard @kenny_baas @[email protected] 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. 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.
  5. Legend Rule Example Example Mapping Question @brunoboucard @kenny_baas @[email protected] Only

    suggest available places Given places 4 to 7 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 requests a suggestion Then A1 and A2 are suggested Given all places are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 requests a suggestion Then No suggestions are found Suggest exclusively adjoining places Suggest places options closer to the stage Suggest places options closer to the center of a row Avoid suggesting individual places vacant in a row, except as a last resort Given places A3 to A6 are reserved And places 4 to 7 are reserved in row B and C A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then A7 to A10 are suggested Given places 4 to 7 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then No suggestions are found Given places 5 to 10 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then A1 to A4 are suggested Given places 5 to 10 in each row are reserved And A1 to A4 are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then B1 to B4 are suggested Make 3 different suggestion per pricing Category A B C 1 2 3 4 5 6 7 8 9 10 When a party of 1 requests a suggestion Then for cat 1: A3, A4,A5 Cat2: A1, A2, A3 And Cat 3 D1, D2, D3 are suggested Given no places are reserved D E Cat 1 Cat 2 Cat 3
  6. Seating Place Recommender 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 Auditorium Seating 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 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. @brunoboucard @kenny_baas @[email protected]
  7. Purpose: Know if they can be suggested Pricing Category First

    Second Third Seating Place Recommender 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 Auditorium Seating 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 Reservations Auditorium Layout @brunoboucard @kenny_baas @[email protected]
  8. @brunoboucard @kenny_baas @[email protected] Purpose: Know if they can be suggested

    Seating Place Recommender Make 3 different suggestion per pricing Category Auditorium Seating AuditoriumSeatings Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating Auditorium Seating Allocate Places Knows its unique ID Suggest places options closer to the stage Row Purpose: Has the overview of all the rows. Auditorium Seating Provider Finds Auditorium Seating Purpose: Adapts auditorium seating to its last known state. Row - Suggests places in row - Make sure suggestions are adjoining - Make sure there individual places vacant in a row - knows the row name - knows the amount of free seats - Suggest places options closer to the center of a row Seating Place Purpose: Knows the layout of a row of places Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not Seating Place Availability Make Suggestion Suggestion is Made Seating Place Availability Reserved available Allocated Suggestion Not found Suggest places options closer to the stage Avoid suggesting individual places vacant in a row, except as a last resort Suggest exclusively adjoining places Suggest places options closer to the center of a row Only suggest available places Reservations Auditorium Layout Reservations Auditorium Layout Auditorium Seating Pricing Category First Second Third Make 3 different suggestion per pricing Category
  9. The DDD Starter Modelling Process - Maxime Sanglan-Cha… YouTube Visual

    and Collaborative Modelling - Kenny Baas-Schwegle… YouTube More on discovery..... @brunoboucard @kenny_baas @[email protected]
  10. Suggest mixed pricing categories Challenging the model with a new

    scenario 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 @brunoboucard @kenny_baas @[email protected]
  11. Bounded Context Inbound communication Outbound communication Suggest mixed pricing categories

    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 Challenging the model with a new scenario @brunoboucard @kenny_baas @[email protected] Purpose: Know if they can be suggested Seating Place Recommender Make 3 different suggestion per pricing Category Auditorium Seating AuditoriumSeatings Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating Auditorium Seating Allocate Places Knows its unique ID Suggest places options closer to the stage Row Purpose: Has the overview of all the rows. Auditorium Seating Provider Finds Auditorium Seating Purpose: Adapts auditorium seating to its last known state. Row - Suggests places in row - Make sure suggestions are adjoining - Make sure there individual places vacant in a row - knows the row name - knows the amount of free seats - Suggest places options closer to the center of a row Seating Place Purpose: Knows the layout of a row of places Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not Seating Place Availability Make Suggestion Suggestion is Made Seating Place Availability Reserved available Allocated Suggestion Not found Suggest places options closer to the stage Avoid suggesting individual places vacant in a row, except as a last resort Suggest exclusively adjoining places Suggest places options closer to the center of a row Only suggest available places Reservations Auditorium Layout Reservations Auditorium Layout Auditorium Seating Pricing Category First Second Third Make 3 different suggestion per pricing Category
  12. @brunoboucard @kenny_baas @[email protected] “Supple design has a profound effect on

    the ability of software to cope with change and complexity.” — Eric Evans, Domain-​ Driven Design: Tackling Complexity in the Heart of Software
  13. @brunoboucard @kenny_baas @[email protected] Goal of a Supple Design: Create a

    domain model that is intuitive, flexible, and robust. Facilitate ease of use and future changes. Outcome of a Supple Design: Intuitive Model: Domain model aligns closely with real-​ world concepts, making it easy to understand. Ease of Use: Developers can use the model correctly and efficiently, with clear APIs and reduced complexity. Flexibility: Model can be easily adapted and extended as requirements change or new insights are gained. Robustness: Model maintains consistency and integrity, minimizing errors and facilitating maintenance. Enhanced Collaboration: Continuous feedback loop between developers and domain experts, improving domain understanding and software quality. This approach ensures the software remains maintainable, adaptable, and aligned with the business needs. 1. 2. 1. 2. 3. 4. 5.
  14. Legend Rule Example Example Mapping Question @brunoboucard @kenny_baas @[email protected] Only

    suggest available places Given places 4 to 7 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 requests a suggestion Then A1 and A2 are suggested Given all places are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 2 requests a suggestion Then No suggestions are found Suggest exclusively adjoining places Suggest places options closer to the stage Suggest places options closer to the center of a row Avoid suggesting individual places vacant in a row, except as a last resort Given places A3 to A6 are reserved And places 4 to 7 are reserved in row B and C A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then A7 to A10 are suggested Given places 4 to 7 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then No suggestions are found Given places 5 to 10 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then A1 to A4 are suggested Given places 5 to 10 in each row are reserved And A1 to A4 are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then B1 to B4 are suggested Make 3 different suggestion per pricing Category A B C 1 2 3 4 5 6 7 8 9 10 When a party of 1 requests a suggestion Then for cat 1: A3, A4,A5 Cat2: A1, A2, A3 And Cat 3 D1, D2, D3 are suggested Given no places are reserved D E Cat 1 Cat 2 Cat 3
  15. Bounded Context Inbound communication Outbound communication Pair/Ensemble modelling: Example Mapping

    and Coding @brunoboucard @kenny_baas @[email protected] Purpose: Know if they can be suggested Seating Place Recommender Make 3 different suggestion per pricing Category Auditorium Seating AuditoriumSeatings Purpose: Makes sure a suggestion for seats can get allocated to the correct Auditorium Seating Auditorium Seating Allocate Places Knows its unique ID Suggest places options closer to the stage Row Purpose: Has the overview of all the rows. Auditorium Seating Provider Finds Auditorium Seating Purpose: Adapts auditorium seating to its last known state. Row - Suggests places in row - Make sure suggestions are adjoining - Make sure there individual places vacant in a row - knows the row name - knows the amount of free seats - Suggest places options closer to the center of a row Seating Place Purpose: Knows the layout of a row of places Seating place Knows the row knows the pricing category Knows the seat number Know if it can be suggested or not Seating Place Availability Make Suggestion Suggestion is Made Seating Place Availability Reserved available Allocated Suggestion Not found Suggest places options closer to the stage Avoid suggesting individual places vacant in a row, except as a last resort Suggest exclusively adjoining places Suggest places options closer to the center of a row Only suggest available places Reservations Auditorium Layout Reservations Auditorium Layout Auditorium Seating Pricing Category First Second Third Make 3 different suggestion per pricing Category Suggest places options closer to the stage Suggest places options closer to the center of a row Avoid suggesting individual places vacant in a row, except as a last resort Given places 5 to 10 in each row are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then A1 to A4 are suggested Given places 5 to 10 in each row are reserved And A1 to A4 are reserved A B C 1 2 3 4 5 6 7 8 9 10 When a party of 4 requests a suggestion Then B1 to B4 are suggested
  16. @brunoboucard @kenny_baas @[email protected] "Deep modeling is about diving into the

    intricacies of the core domain, uncovering the hidden complexities, and ensuring our software truly reflects the business's most critical and competitive aspects." — Eric Evans, Domain-​ Driven Design: Tackling Complexity in the Heart of Software
  17. @brunoboucard @kenny_baas @[email protected] “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 Enables
  18. @brunoboucard @kenny_baas @[email protected] 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. How a deeper software model enables breakthroughs in product development
  19. @brunoboucard @kenny_baas @[email protected] Chapter Thirteen Refactoring toward deeper insights is

    a multi-​ faceted process. It will be helpful to stop for a moment to pull together the major points. There are thee things you have to focus on. Live in the domain Keep looking at things a different way Maintain an unbroken dialog with domain experts. 1. 2. 3.
  20. @brunoboucard @kenny_baas @[email protected] Had a good taste and want more?

    www.avanscoperta.it Deep Dive into Model- Driven Design Workshop | Avanscoperta Online | Get to experience the true power of Domain-Driven Design and go beyond using the basic tactical patterns. https://www.avanscoperta.it/en/training/deep-​ dive-​ into-​ model-​ driven-​ design-​ workshop/