Slide 1

Slide 1 text

Deep Dive into Model-​ Driven Design: Refining Domain Models in Code @brunoboucard @kenny_baas @[email protected]

Slide 2

Slide 2 text

@brunoboucard @kenny_baas @[email protected] Domain-​ Driven Design is a discipline rooted in the belief that creating good software systems for problems in the complex domain cannot be done without a deep understanding of the business problems you are trying to solve in the domain.

Slide 3

Slide 3 text

@brunoboucard @kenny_baas @[email protected] Users and stakeholders Code Stream-​Aligned Team Tests Domain Model Other people possibly involved in designing and building software Managers Architects User researcher .....

Slide 4

Slide 4 text

@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.

Slide 5

Slide 5 text

@brunoboucard @kenny_baas @[email protected] Purpose: Know if they can be suggested Seating Place Suggesting maker 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 Seatings 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 Seating Place Availability Reserved available Allocated Auditorium Seating Pricing Category First Second Third 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.

Slide 6

Slide 6 text

@brunoboucard @kenny_baas @[email protected] Purpose: Know if they can be suggested Seating Place Suggesting maker 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 Seatings 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 Seating Place Availability Reserved available Allocated Auditorium Seating Pricing Category First Second Third This an initial software model, one that is grounded in basic understanding. Does that model over time fail to accurately reflect the main concerns of domain experts?

Slide 7

Slide 7 text

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]

Slide 8

Slide 8 text

@brunoboucard @kenny_baas @[email protected]

Slide 9

Slide 9 text

add value objects Use closure of operations Heuristics @brunoboucard @kenny_baas @[email protected]

Slide 10

Slide 10 text

Cat 1 Cat 2 Suggest places options closer to the center of a row Cat 1 Cat 2 Number 1  ​   ​ 2  ​ 3  ​ 4  ​ 5  ​ 6  ​ 7   ​ 8   ​ 9  ​ 10 Number 1  ​   ​ 2  ​ 3  ​ 4  ​ 5  ​ 6  ​ 7   ​ 8   ​ 9  ​ 10 11 @brunoboucard @kenny_baas @[email protected] Party of 2 Purpose: Know if they can be suggested Auditorium Seating Allocate Places Knows its unique ID Suggest places options closer to the stage Row Purpose: Has the overview of all the rows. 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

Slide 11

Slide 11 text

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 @brunoboucard @kenny_baas @[email protected]

Slide 12

Slide 12 text

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 @brunoboucard @kenny_baas @[email protected]

Slide 13

Slide 13 text

Start implementation in your unit test Make your domain concepts explicit Heuristics Your code should be explainable on a whiteboard with stakeholders Deep modelling @brunoboucard @kenny_baas @[email protected]

Slide 14

Slide 14 text

“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 @brunoboucard @kenny_baas @[email protected]

Slide 15

Slide 15 text

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 https://github.com/42skillz/How-​ a-​ deeper-​ software-​ model-​ enables-​ breakthroughs-​ in-​ product-​ development The code: @brunoboucard @kenny_baas @[email protected]

Slide 16

Slide 16 text

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. @brunoboucard @kenny_baas @[email protected]

Slide 17

Slide 17 text

@brunoboucard @kenny_baas @[email protected] Want to know 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/

Slide 18

Slide 18 text

@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 https://virtualddd.com @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 and legacy code refactoring with an extra soul. https://octo.com @brunoboucard .linkedin.com/brunoboucard/