SlideShare a Scribd company logo
1 of 26
Domain Driven Design
Satish Mittal
VP Engineering
Practo
Motivation
Typical application development:
Requirements from business
Task breakdown
Jump to implementation
DB schema - tables and columns
Fast, we are a Startup!
Problems
1. Your project has the same functionality implemented in the same way or
different in different places?
2. You have more than one object for the same item?
3. You have objects that have properties that are not actually attributes of that
object?
4. You have no or very poor relationship among related items?
5. Looking at your objects it is not possible to understand what actually the
whole application is all about?
Problems
Bottom-up vs Top-down approach
Here-and-now vs big-picture
Do I understand the domain of the application?
Solution
Domain Driven Design (DDD)
Coined by Eric Evans
Wikipedia: Domain-driven design is not a technology or a methodology. DDD
provides a structure of practices and terminology for making design decisions
that focus and accelerate software projects dealing with complicated
domains.
Idea: Focus more on complexities intrinsic to core business domain
Domain
Wikipedia: A sphere of knowledge, influence, or activity. The subject area to
which the user applies a program is the domain of the software
Examples:
E-commerce
Professional network
Advertisement
Healthcare
...
What is a model?
It’s not just diagrams (UML, ER): views of model
Model is the set of concepts that we have chosen to implement in our software
Business differentiator
Pattern: Model-driven design
First build an of domain model that actually represents the problem domain
Then express that in code at all times
Change in domain <-> Change in code
Ubiquitous Language
All stakeholders should speak the same language
Product-developers
Developers-developers
The language must be business language, and not technical details
Language: Entity
A concept that has a unique identity within system
Two entities can only be same if their identity is identical
Typically persisted, mutable, status change
Examples:
Friend in Facebook
Item in shopping cart: SKU
News Article: URL
Language: Value Object
Represents a set of attributes
e.g. doors in a room, items in an order, profile details
Typically it has no unique identity of its own
It should be immutable
In some cases, Value Object might become an entity (when unique identity is
needed to invoke some action)
Example: last N SearchCriteria
Language: Value Object
E.g. money: int, double field in code?
How about various currencies: INR/USD?
Recommendation: Define unique class
Money m1 = new Money("GBP", 10);
Money m2 = new Money("GBP", 20);
Money m3 = m1.add(m2);
Typically immutable
Adding m1 to m2 doesn’t alter m1; returns m3
Language: Value Object
E.g. SocialSecurityNumber
E.g. MobilePhoneNumber
E.g. PatientRegistrationNumber
Perform common validations within each class: range check, syntax, format
Refactor duplicate implementations out of applications
Language: Module
Package or library or namespace
Collection of entities and Value Objects related to a context
Focus on having as much reusable modules amongst applications across
company
Language: Aggregate Roots
Entity relationship types: association, aggregation or composition
An aggregate root (AR) is an entity that composes other entities (as well as its
own Value Object) by composition.
Example:
Consult Question (AR) contains multiple Answers. However any Answer can’t exist without
Question
Aggregated entities are referenced only by the root (may be transitively), and
may not be referenced by any objects outside the aggregate.
Some entities are aggregate roots themselves (single node tree)
Language: Aggregate Roots
Identifying AR allows us to define the logical atomic unit of work
critical section of a transaction
AR is responsible for ensuring that all its child entities are always in consistent
state across operations
Example:
Order (AR) contains OrderItems; all OrderItems must be unique
Referential Integrity across ARs:
Appointment for a slot must be given only if Doctor is available that day
Language: Repository
Domain must be agnostic of persistence (MySQL, ES, Redis, FS..)
Repository is an abstraction over persistence layer
Returns collections of aggregate roots (typically meeting some criteria)
Repository is a domain level concept - represented via Interface
Actual implementations belong to Infrastructure layer
Dependency Injection
Domain Service: Represents core business actions, operations on Domain
Entities; manages business rules
Example: Appointment booking, medicine order
Application Service: Handles cross-cutting concerns like transactions, security
etc.
Infrastructure Service: Underlying tech implementation layer
Example: MySQL, SMS communicator, push notification
Language: Service Types
Language: Service Types
Layered architecture
Spectrum of granularity
Value Object < entity < aggregate < module < bounded context
Language: Bounded Context
BC: The functional boundary within which domain model make sense
Recommendation: Divide large application among multiple BCs
More modular
Separation of different concerns
Helps manage and enhance application in an efficient way
Each BC operates in a semi-autonomous fashion
Each BC owned by separate team: domain expert
Avoid BBOM (Big Ball of Mud): unstructured, duct-tape, sphagetti code
Bounded Context: Relationships
published language: the interacting BCs agree on a common language (e.g.
domain schema) by which they can interact with each other;
open host service: a BC specifies a protocol (e.g. RPC/RESTful web service)
by which any other BC can use its services;
shared kernel: two BCs use a common kernel of code (e.g. a library)
Bounded Context: Relationships
customer/supplier: one BC uses the services of another and is a stakeholder
(customer) of that other BC. As such it can influence the services provided by
that BC;
conformist: one BC uses the services of another but is not a stakeholder to that
other BC. As such it uses "as-is" (conforms to) the protocols or APIs provided
by that BC;
anti-corruption layer: one BC uses the services of another and is not a
stakeholder, but aims to minimize impact from changes in the BC it depends
on by introducing a set of adapters – an anti-corruption layer.
Context Map
DDD recommends to draw Context Map to identify which BC do you depend
upon, and which BC depend upon you
Dependency graph amongst systems, with edges that capture the co-operation
level
Helps understand the inter-dependencies better
Helps streamline upstream model changes
Thanks!

More Related Content

What's hot

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignAndriy Buday
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven developmentDmitry Geyzersky
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroFabrício Rissetto
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsAlexander van Trijffel
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Alan Christensen
 
The Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsThe Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsNick Tune
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignAOE
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
Clean architecture
Clean architectureClean architecture
Clean architectureandbed
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean ArchitectureRoc Boronat
 

What's hot (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven development
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain Models
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
The Art of Discovering Bounded Contexts
The Art of Discovering Bounded ContextsThe Art of Discovering Bounded Contexts
The Art of Discovering Bounded Contexts
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Microservices Decomposition Patterns
Microservices Decomposition PatternsMicroservices Decomposition Patterns
Microservices Decomposition Patterns
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean Architecture
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Why Microservices
Why MicroservicesWhy Microservices
Why Microservices
 

Viewers also liked

Project Management in Digital Age
Project Management in Digital AgeProject Management in Digital Age
Project Management in Digital AgeMehdi Shamizanjani
 
詹姆士看天下 2017/02/13
詹姆士看天下 2017/02/13詹姆士看天下 2017/02/13
詹姆士看天下 2017/02/13ezfunds
 
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...Maxi Silvestre
 
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~さくらのIoT Platformを使ってみよう ~OSC浜名湖編~
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~法林浩之
 
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6vinhbinh2010
 
Eu coal stress_test_report_2017 WindSolar = More and More Coal (1)
Eu coal stress_test_report_2017  WindSolar = More and More Coal (1)Eu coal stress_test_report_2017  WindSolar = More and More Coal (1)
Eu coal stress_test_report_2017 WindSolar = More and More Coal (1)www.thiiink.com
 
999C1400_De NoraGWSBrochure_Sept15-EMAIL
999C1400_De NoraGWSBrochure_Sept15-EMAIL999C1400_De NoraGWSBrochure_Sept15-EMAIL
999C1400_De NoraGWSBrochure_Sept15-EMAILAlfredo Romanelli
 
Idempotent filter with mule
Idempotent filter with muleIdempotent filter with mule
Idempotent filter with muleSon Nguyen
 
BU On Campus presentation of Apr 19 2011
BU On Campus presentation of Apr 19 2011BU On Campus presentation of Apr 19 2011
BU On Campus presentation of Apr 19 2011Jeff Allar
 
EN2 Characteristics of prophecy 2 of 6
EN2 Characteristics of prophecy 2 of 6EN2 Characteristics of prophecy 2 of 6
EN2 Characteristics of prophecy 2 of 6Learning to Prophesy
 
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)takashi ono
 
Domain-driven design
Domain-driven designDomain-driven design
Domain-driven designKnoldus Inc.
 

Viewers also liked (14)

Server-side Swift
Server-side SwiftServer-side Swift
Server-side Swift
 
Project Management in Digital Age
Project Management in Digital AgeProject Management in Digital Age
Project Management in Digital Age
 
詹姆士看天下 2017/02/13
詹姆士看天下 2017/02/13詹姆士看天下 2017/02/13
詹姆士看天下 2017/02/13
 
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...
Evolución del marketing educativo hasta el Inbound marketing. Marketing and S...
 
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~さくらのIoT Platformを使ってみよう ~OSC浜名湖編~
さくらのIoT Platformを使ってみよう ~OSC浜名湖編~
 
Contextual Theology
Contextual TheologyContextual Theology
Contextual Theology
 
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6
JANUARY 2017 - Pictures of the day - Jan. 1 - Jan. 6
 
Eu coal stress_test_report_2017 WindSolar = More and More Coal (1)
Eu coal stress_test_report_2017  WindSolar = More and More Coal (1)Eu coal stress_test_report_2017  WindSolar = More and More Coal (1)
Eu coal stress_test_report_2017 WindSolar = More and More Coal (1)
 
999C1400_De NoraGWSBrochure_Sept15-EMAIL
999C1400_De NoraGWSBrochure_Sept15-EMAIL999C1400_De NoraGWSBrochure_Sept15-EMAIL
999C1400_De NoraGWSBrochure_Sept15-EMAIL
 
Idempotent filter with mule
Idempotent filter with muleIdempotent filter with mule
Idempotent filter with mule
 
BU On Campus presentation of Apr 19 2011
BU On Campus presentation of Apr 19 2011BU On Campus presentation of Apr 19 2011
BU On Campus presentation of Apr 19 2011
 
EN2 Characteristics of prophecy 2 of 6
EN2 Characteristics of prophecy 2 of 6EN2 Characteristics of prophecy 2 of 6
EN2 Characteristics of prophecy 2 of 6
 
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)
マーケティングオートメーション&Mauticとは(WordBench Nagoya 2017年2月勉強会)
 
Domain-driven design
Domain-driven designDomain-driven design
Domain-driven design
 

Similar to Domain driven design

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignMuhammad Ali
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignLalit Kale
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSSeminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSMizanur Sarker
 
Arch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptxArch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptxSanjoy Kumar Roy
 
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"GlobalLogic Ukraine
 
Domain driven design
Domain driven designDomain driven design
Domain driven designtatyaso
 
The Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsThe Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsAlessandro Giorgetti
 
Making Inter-operability Visible
Making Inter-operability VisibleMaking Inter-operability Visible
Making Inter-operability Visibleliddy
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven DesignAndré Borgonovo
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
Patterns&Antipatternsof SOA
Patterns&Antipatternsof SOAPatterns&Antipatternsof SOA
Patterns&Antipatternsof SOAMohamed Samy
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-designArnaud Bouchez
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .netMarco Parenzan
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introductionAsher Sterkin
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsSteve Speicher
 

Similar to Domain driven design (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRSSeminar - Scalable Enterprise Application Development Using DDD and CQRS
Seminar - Scalable Enterprise Application Development Using DDD and CQRS
 
DDD
DDDDDD
DDD
 
Arch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptxArch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptx
 
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
Java TechTalk "Spring boot made life easier with Kubernetes and Microservices"
 
DDD eXchange
DDD eXchangeDDD eXchange
DDD eXchange
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
The Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsThe Big Picture - Integrating Buzzwords
The Big Picture - Integrating Buzzwords
 
Making Inter-operability Visible
Making Inter-operability VisibleMaking Inter-operability Visible
Making Inter-operability Visible
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven Design
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Patterns&Antipatternsof SOA
Patterns&Antipatternsof SOAPatterns&Antipatternsof SOA
Patterns&Antipatternsof SOA
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
Developing Actors in Azure with .net
Developing Actors in Azure with .netDeveloping Actors in Azure with .net
Developing Actors in Azure with .net
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC Integrations
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Domain driven design

  • 1. Domain Driven Design Satish Mittal VP Engineering Practo
  • 2. Motivation Typical application development: Requirements from business Task breakdown Jump to implementation DB schema - tables and columns Fast, we are a Startup!
  • 3. Problems 1. Your project has the same functionality implemented in the same way or different in different places? 2. You have more than one object for the same item? 3. You have objects that have properties that are not actually attributes of that object? 4. You have no or very poor relationship among related items? 5. Looking at your objects it is not possible to understand what actually the whole application is all about?
  • 4. Problems Bottom-up vs Top-down approach Here-and-now vs big-picture Do I understand the domain of the application?
  • 5. Solution Domain Driven Design (DDD) Coined by Eric Evans Wikipedia: Domain-driven design is not a technology or a methodology. DDD provides a structure of practices and terminology for making design decisions that focus and accelerate software projects dealing with complicated domains. Idea: Focus more on complexities intrinsic to core business domain
  • 6. Domain Wikipedia: A sphere of knowledge, influence, or activity. The subject area to which the user applies a program is the domain of the software Examples: E-commerce Professional network Advertisement Healthcare ...
  • 7. What is a model? It’s not just diagrams (UML, ER): views of model Model is the set of concepts that we have chosen to implement in our software Business differentiator
  • 8. Pattern: Model-driven design First build an of domain model that actually represents the problem domain Then express that in code at all times Change in domain <-> Change in code
  • 9. Ubiquitous Language All stakeholders should speak the same language Product-developers Developers-developers The language must be business language, and not technical details
  • 10. Language: Entity A concept that has a unique identity within system Two entities can only be same if their identity is identical Typically persisted, mutable, status change Examples: Friend in Facebook Item in shopping cart: SKU News Article: URL
  • 11. Language: Value Object Represents a set of attributes e.g. doors in a room, items in an order, profile details Typically it has no unique identity of its own It should be immutable In some cases, Value Object might become an entity (when unique identity is needed to invoke some action) Example: last N SearchCriteria
  • 12. Language: Value Object E.g. money: int, double field in code? How about various currencies: INR/USD? Recommendation: Define unique class Money m1 = new Money("GBP", 10); Money m2 = new Money("GBP", 20); Money m3 = m1.add(m2); Typically immutable Adding m1 to m2 doesn’t alter m1; returns m3
  • 13. Language: Value Object E.g. SocialSecurityNumber E.g. MobilePhoneNumber E.g. PatientRegistrationNumber Perform common validations within each class: range check, syntax, format Refactor duplicate implementations out of applications
  • 14. Language: Module Package or library or namespace Collection of entities and Value Objects related to a context Focus on having as much reusable modules amongst applications across company
  • 15. Language: Aggregate Roots Entity relationship types: association, aggregation or composition An aggregate root (AR) is an entity that composes other entities (as well as its own Value Object) by composition. Example: Consult Question (AR) contains multiple Answers. However any Answer can’t exist without Question Aggregated entities are referenced only by the root (may be transitively), and may not be referenced by any objects outside the aggregate. Some entities are aggregate roots themselves (single node tree)
  • 16. Language: Aggregate Roots Identifying AR allows us to define the logical atomic unit of work critical section of a transaction AR is responsible for ensuring that all its child entities are always in consistent state across operations Example: Order (AR) contains OrderItems; all OrderItems must be unique Referential Integrity across ARs: Appointment for a slot must be given only if Doctor is available that day
  • 17. Language: Repository Domain must be agnostic of persistence (MySQL, ES, Redis, FS..) Repository is an abstraction over persistence layer Returns collections of aggregate roots (typically meeting some criteria) Repository is a domain level concept - represented via Interface Actual implementations belong to Infrastructure layer Dependency Injection
  • 18. Domain Service: Represents core business actions, operations on Domain Entities; manages business rules Example: Appointment booking, medicine order Application Service: Handles cross-cutting concerns like transactions, security etc. Infrastructure Service: Underlying tech implementation layer Example: MySQL, SMS communicator, push notification Language: Service Types
  • 20. Spectrum of granularity Value Object < entity < aggregate < module < bounded context
  • 21. Language: Bounded Context BC: The functional boundary within which domain model make sense Recommendation: Divide large application among multiple BCs More modular Separation of different concerns Helps manage and enhance application in an efficient way Each BC operates in a semi-autonomous fashion Each BC owned by separate team: domain expert Avoid BBOM (Big Ball of Mud): unstructured, duct-tape, sphagetti code
  • 22. Bounded Context: Relationships published language: the interacting BCs agree on a common language (e.g. domain schema) by which they can interact with each other; open host service: a BC specifies a protocol (e.g. RPC/RESTful web service) by which any other BC can use its services; shared kernel: two BCs use a common kernel of code (e.g. a library)
  • 23. Bounded Context: Relationships customer/supplier: one BC uses the services of another and is a stakeholder (customer) of that other BC. As such it can influence the services provided by that BC; conformist: one BC uses the services of another but is not a stakeholder to that other BC. As such it uses "as-is" (conforms to) the protocols or APIs provided by that BC; anti-corruption layer: one BC uses the services of another and is not a stakeholder, but aims to minimize impact from changes in the BC it depends on by introducing a set of adapters – an anti-corruption layer.
  • 24.
  • 25. Context Map DDD recommends to draw Context Map to identify which BC do you depend upon, and which BC depend upon you Dependency graph amongst systems, with edges that capture the co-operation level Helps understand the inter-dependencies better Helps streamline upstream model changes