SlideShare a Scribd company logo
Domain Driven Design
Josh Dastmalchi
Let’s Drive a Manual Car
How do we shift gears?
• Press the clutch pedal to the floor
• Use the gear shift to change gears
• Depress the clutch pedal while also pressing the gas pedal
Okay, Let’s Drive!
The Importance of Why, What, When
Priorities
Correctness
• If it doesn’t do what we intended, we have failed.
• Testability – how do I know I’m correct?
Ease of Change
• Software is never done.
• An anecdote: “This requirement will definitely never change”
Methods
Ubiquitous Language
• To achieve correctness, we must communicate the product needs.
• If we're not speaking the same language, we're off to a bad start.
• What if we all had different native languages?
The Boot
Contextless Truth
• The truth of a domain exists outside of any user interface or database.
• Use Cases:
• The domain defines truth - what is possible in reality
• A use case defines what is possible in the application
Patterns
• Establishing patterns takes the mystery away from doing common tasks.
• Command-Query Responsibility Segregation
• Repository
• Hexagonal
The Code
What everyone really wants to see
Domain Events
Represents a change of state in our domain.
• All domain mutations produce domain events recording them.
• Event handlers can listen for these events and perform actions accordingly
• Enables event sourcing, a powerful but complex way to store domain history.
Domain Events: My experience
• They won’t feel useful initially – but they unlock a lot of power for later
complexity.
• Generally there are two types of handlers:
• Handlers that enforce domain rules of the form “When x, then y”
• Handlers that inform other systems of changes in our domain
• Include enough information in events to make them reversible
• Prefer domain services or entities to event handlers
Entities
Represents a concept in our domain.
• Has an immutable unique identifier.
• Enforces invariants (domain rules) and never allows itself to be in an invalid state.
Aggregates
Aggregates are a special type of entity.
• An aggregate cannot be nested in another entity's object graph.
• An aggregate can be referenced by ID by another entity.
• Non-aggregate entities do not track events.
• Non-aggregate entities do not have public methods.
Aggregates: My Experience
• Minimize aggregate size.
• (Almost) never use non-aggregate entities.
Value Objects
Represents a complex property in our domain.
• In contrast to entities, equality is determined by a value object’s properties, not a
unique identifier.
• Like entities, these are self-validating.
Value Objects: My Experience
• For primitive types, always consider wrapping them in a value object.
• If an entity has complex validation across multiple properties, consider wrapping
them all together as a value object.
• Wrapping your aggregate identifiers as value objects provides type safety in a
place where it is very easy to make mistakes.
Domain Service
• An implementation of orchestrated domain logic that can’t be put on an
aggregate
• Common reasons to use a service:
• Uniqueness checks
• Configuration-based logic
• Interaction with multiple aggregates
Domain Services: My Experience
• Use single-purpose services and composition instead of large services
• Avoid an anemic domain: prefer entity-based logic over service-based logic
• If an entity method requires service orchestration, use access modifiers to prevent
non-domain calls
Major Takeaways: Why
Priorities
1. Correctness
2. Ease of change
Methods
• Ubiquitous language
• Contextless truth
Major Takeaways: How
• Domain design: Correctness & Ease of Change
• Domain logic: Entity > Service > Event Handler
• Small entities, small services
Live Demo
Real Practice – Adapting the Domain
• A doctor’s name must be at least 3 characters, can be no more than 50 characters, and
must consist of only alphanumeric characters.
• An appointment can only be scheduled in increments of 15 minutes. Specifically,
appointment times must end in :00, :15, :30, or :45.
• Doctors get days off – holidays, time off, etc. We should add a concept of a doctor’s
time off that specifies a date and hours on that date during which a doctor is
unavailable. This should prevent appointments being scheduled during that time and
delete any existing appointments during that time. Time off should only be able to be
scheduled in the future.
Links
• Source Code: https://github.com/josh-dastmalchi/ddd-example

More Related Content

Similar to Domain Driven Design Belfast Meetup - Overview, Lessons and Examples by Josh Dastmalchi

Making a Mock by Kelsey Shannahan
Making a Mock by Kelsey ShannahanMaking a Mock by Kelsey Shannahan
Making a Mock by Kelsey Shannahan
QA or the Highway
 
What are microservices
What are microservicesWhat are microservices
What are microservices
Krunalkumar Rajdip
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutes
Andrew Siemer
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
Tom Kocjan
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
AgileNetwork
 
2.IntelligentAgents.ppt
2.IntelligentAgents.ppt2.IntelligentAgents.ppt
2.IntelligentAgents.ppt
GopiSuresh8
 
Generating unit tests based on user logs
Generating unit tests based on user logsGenerating unit tests based on user logs
Generating unit tests based on user logs
Rick Wicker
 
Dealing With The Input Providers
Dealing With The Input ProvidersDealing With The Input Providers
Dealing With The Input Providers
dclsocialmedia
 
Using Hystrix to Build Resilient Distributed Systems
Using Hystrix to Build Resilient Distributed SystemsUsing Hystrix to Build Resilient Distributed Systems
Using Hystrix to Build Resilient Distributed Systems
Matt Jacobs
 
Grails Services
Grails ServicesGrails Services
Grails Services
NexThoughts Technologies
 
Microservices: Yes or not?
Microservices: Yes or not?Microservices: Yes or not?
Microservices: Yes or not?
Eduard Tomàs
 
User Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh VaradharajanUser Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh Varadharajan
Agile Testing Alliance
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people mattered
Aryan Rathore
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
Allan Mangune
 
Practical Agile. Lessons learned the hard way on our journey building digita...
Practical Agile.  Lessons learned the hard way on our journey building digita...Practical Agile.  Lessons learned the hard way on our journey building digita...
Practical Agile. Lessons learned the hard way on our journey building digita...
TechExeter
 
Practical agile TechExeter
Practical agile TechExeterPractical agile TechExeter
Practical agile TechExeter
Ian Ames
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
Michael Heron
 
Scaling Systems: Architectures that grow
Scaling Systems: Architectures that growScaling Systems: Architectures that grow
Scaling Systems: Architectures that grow
Gibraltar Software
 
02 Models of Distribution Systems.pdf
02 Models of Distribution Systems.pdf02 Models of Distribution Systems.pdf
02 Models of Distribution Systems.pdf
RobeliaJoyVillaruz
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
Kevin Mas Ruiz
 

Similar to Domain Driven Design Belfast Meetup - Overview, Lessons and Examples by Josh Dastmalchi (20)

Making a Mock by Kelsey Shannahan
Making a Mock by Kelsey ShannahanMaking a Mock by Kelsey Shannahan
Making a Mock by Kelsey Shannahan
 
What are microservices
What are microservicesWhat are microservices
What are microservices
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutes
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
 
2.IntelligentAgents.ppt
2.IntelligentAgents.ppt2.IntelligentAgents.ppt
2.IntelligentAgents.ppt
 
Generating unit tests based on user logs
Generating unit tests based on user logsGenerating unit tests based on user logs
Generating unit tests based on user logs
 
Dealing With The Input Providers
Dealing With The Input ProvidersDealing With The Input Providers
Dealing With The Input Providers
 
Using Hystrix to Build Resilient Distributed Systems
Using Hystrix to Build Resilient Distributed SystemsUsing Hystrix to Build Resilient Distributed Systems
Using Hystrix to Build Resilient Distributed Systems
 
Grails Services
Grails ServicesGrails Services
Grails Services
 
Microservices: Yes or not?
Microservices: Yes or not?Microservices: Yes or not?
Microservices: Yes or not?
 
User Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh VaradharajanUser Story Writing & Estimation For Testers By Mahesh Varadharajan
User Story Writing & Estimation For Testers By Mahesh Varadharajan
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people mattered
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
Practical Agile. Lessons learned the hard way on our journey building digita...
Practical Agile.  Lessons learned the hard way on our journey building digita...Practical Agile.  Lessons learned the hard way on our journey building digita...
Practical Agile. Lessons learned the hard way on our journey building digita...
 
Practical agile TechExeter
Practical agile TechExeterPractical agile TechExeter
Practical agile TechExeter
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
Scaling Systems: Architectures that grow
Scaling Systems: Architectures that growScaling Systems: Architectures that grow
Scaling Systems: Architectures that grow
 
02 Models of Distribution Systems.pdf
02 Models of Distribution Systems.pdf02 Models of Distribution Systems.pdf
02 Models of Distribution Systems.pdf
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
 

Recently uploaded

Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 

Recently uploaded (20)

Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 

Domain Driven Design Belfast Meetup - Overview, Lessons and Examples by Josh Dastmalchi

  • 2. Let’s Drive a Manual Car
  • 3. How do we shift gears? • Press the clutch pedal to the floor • Use the gear shift to change gears • Depress the clutch pedal while also pressing the gas pedal
  • 5. The Importance of Why, What, When
  • 7. Correctness • If it doesn’t do what we intended, we have failed. • Testability – how do I know I’m correct?
  • 8. Ease of Change • Software is never done. • An anecdote: “This requirement will definitely never change”
  • 10. Ubiquitous Language • To achieve correctness, we must communicate the product needs. • If we're not speaking the same language, we're off to a bad start. • What if we all had different native languages?
  • 12. Contextless Truth • The truth of a domain exists outside of any user interface or database. • Use Cases: • The domain defines truth - what is possible in reality • A use case defines what is possible in the application
  • 13. Patterns • Establishing patterns takes the mystery away from doing common tasks. • Command-Query Responsibility Segregation • Repository • Hexagonal
  • 14. The Code What everyone really wants to see
  • 15. Domain Events Represents a change of state in our domain. • All domain mutations produce domain events recording them. • Event handlers can listen for these events and perform actions accordingly • Enables event sourcing, a powerful but complex way to store domain history.
  • 16.
  • 17.
  • 18. Domain Events: My experience • They won’t feel useful initially – but they unlock a lot of power for later complexity. • Generally there are two types of handlers: • Handlers that enforce domain rules of the form “When x, then y” • Handlers that inform other systems of changes in our domain • Include enough information in events to make them reversible • Prefer domain services or entities to event handlers
  • 19. Entities Represents a concept in our domain. • Has an immutable unique identifier. • Enforces invariants (domain rules) and never allows itself to be in an invalid state.
  • 20. Aggregates Aggregates are a special type of entity. • An aggregate cannot be nested in another entity's object graph. • An aggregate can be referenced by ID by another entity. • Non-aggregate entities do not track events. • Non-aggregate entities do not have public methods.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Aggregates: My Experience • Minimize aggregate size. • (Almost) never use non-aggregate entities.
  • 29. Value Objects Represents a complex property in our domain. • In contrast to entities, equality is determined by a value object’s properties, not a unique identifier. • Like entities, these are self-validating.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Value Objects: My Experience • For primitive types, always consider wrapping them in a value object. • If an entity has complex validation across multiple properties, consider wrapping them all together as a value object. • Wrapping your aggregate identifiers as value objects provides type safety in a place where it is very easy to make mistakes.
  • 36. Domain Service • An implementation of orchestrated domain logic that can’t be put on an aggregate • Common reasons to use a service: • Uniqueness checks • Configuration-based logic • Interaction with multiple aggregates
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43. Domain Services: My Experience • Use single-purpose services and composition instead of large services • Avoid an anemic domain: prefer entity-based logic over service-based logic • If an entity method requires service orchestration, use access modifiers to prevent non-domain calls
  • 44. Major Takeaways: Why Priorities 1. Correctness 2. Ease of change Methods • Ubiquitous language • Contextless truth
  • 45. Major Takeaways: How • Domain design: Correctness & Ease of Change • Domain logic: Entity > Service > Event Handler • Small entities, small services
  • 47. Real Practice – Adapting the Domain • A doctor’s name must be at least 3 characters, can be no more than 50 characters, and must consist of only alphanumeric characters. • An appointment can only be scheduled in increments of 15 minutes. Specifically, appointment times must end in :00, :15, :30, or :45. • Doctors get days off – holidays, time off, etc. We should add a concept of a doctor’s time off that specifies a date and hours on that date during which a doctor is unavailable. This should prevent appointments being scheduled during that time and delete any existing appointments during that time. Time off should only be able to be scheduled in the future.
  • 48. Links • Source Code: https://github.com/josh-dastmalchi/ddd-example