SlideShare a Scribd company logo
Applying

Domain-Driven Design to craft

Rich Domain Models
Alexander van Trijffel Templates
Powerpoint
6-2-2014
Agenda
•
•
•
•
•
•

What is a domain model?
Hexagonal Architecture
Ubiquitous Language
When to use Domain-Driven Design?
Adding behavior to the domain model
Value objects
The domain model
Represents business objects, operations and events that reflect the
business processes and are meaningful to the business representatives.

Business rules
‘An Asset Value Correlation multiplier must be applied for exposures with to
Financial Sector Entities with assets of at least $100 bn’
‘In case no Country of Risk is registered in UCI, the C-rating should be ‘No Rating’

Behavior
‘When an assessment is activated, a Global Facility Id is requested from UFI and
assigned to the assessment’
‘When an employee states that he has outside interests, the system accepts stock positions
under certain conditions’
Invariants
‘A confirmed assessment has been calculated’
‘An activated assessment has a GFID’

‘A counterparty has an Wwid’
‘A protection covers at least one debtor’
Hexagonal Architecture
The blue book
DDD on strategic level
Second Page :

"Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est
laborum."

Do we speak the same language?
Ubiquitous
language
DDD on tactical level
Aren’t we
doing DDD
already?

We have
entities…
And our managers/services/*
know all about the logic…

* enter your favorite name for the application service role here
We have a separate business layer
Hello Anemic Domain Model!
When to invest in developing an
ubiquitous language and implementing
a Rich Domain Model?

System type

Domain logic
Complexity

Use cases

DDD
pays off?

CRUD,
Master data, Lookup

Low

Any

No

Simple, Small, Utility

Low

< 30

No

Departmental,
Narrow scoped

Medium

between
30 and 40

Could be

Innovative

Unknown

?

Yes

Enterprise System,
Core system

High

> 40

Yes
Object Oriented Software:
• Encapsulates data and operations in objects

that interact with each other via the object’s interface.

• Applies information hiding; Internal representation
of objects is hidden to clients

Object oriented means that an object manages its state and
guarantees that it is in a legal state at any time.
By applying Object Orientation to the domain model,
the model:
• can ensure that its state is correct at all times
• can hide complexity behind its public interface
Anemic Domain Model example
Applying business rules
What if we have business rules on the client Status as well?

Things get messy quickly…
Empowering the domain:
Encapsulating data and operations in domain objects
Encapsulating domain logic in value objects
Value object – immutable and comparable by its attributes
Model object as Entity or Value Object?
Entity

Value object

Unique

Can have many occurences

Distinguished by identity

Distinguished by attributes

Can be changed

Immutable
Money: Entity or value object?
Value objects examples

Percentage
Probability of Default
Loss Given Default
World Wide Id
Global Facility Id
Rating

Address
Country
Decision
Period
Status
Other tactical DDD patterns to explore:
• Domain Services
• Domain Events

• Aggregates
Summary

Domain-Driven Design is a methodology that provides patterns
for designing rich domains that encapsulate data and behavior.
The investment in developing an ubiquitous language and
implementing a rich domain model pays off for medium to large
applications that implement business rules and processes.
By applying Object Oriented principles to the domain, business
logic is easier to test, understand and extend.
Thanks for
your attention!
Resources

• Domain-Driven Design: Tackling Complexity in the Heart of
Software (Eric Evans)

• Implementing Domain-Driven Design
Vaughn Vernon

• DDD/CQRS mailing list

https://groups.google.com/forum/#!forum/dddcqrs
Backup slides
Empowering the domain:
Constructing objects
What does it mean to be a client in our domain?

• Does a client without a wwid make sense?
• Does our domain even support clients without ratings?
Communicate the intent of a client through the API:
Empowering the domain:
Encapsulated collections

Can the domain object guarantee that the Ratings collection is
valid at all times?
Does it make sense to clear all ratings? Duplicate a rating?
Empowering the domain:
Encapsulated collections

We provide an explicit API to manipulate the collection.

More Related Content

What's hot

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Nader Albert
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Young-Ho Cho
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
wojtek_s
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
Andriy Buday
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführung
die.agilen GmbH
 
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
Dmitry Geyzersky
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
David Berliner
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
Mustafa Dağdelen
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
thinkddd
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
Pascal Laurin
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
Arnaud Bouchez
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
Eduards Sizovs
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
Alan Christensen
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
Mariam Hakobyan
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
Christos Tsakostas
 
Clean architecture
Clean architectureClean architecture
Clean architecture
Lieven Doclo
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
Araf Karsh Hamid
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Up2 Technology
 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
Nicolò Pignatelli
 

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
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführung
 
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
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
 

Viewers also liked

Building Rich Domain Models
Building Rich Domain ModelsBuilding Rich Domain Models
Building Rich Domain Models
Chris Richardson
 
Agile Modeling In Color (Agile China 2009)
Agile Modeling In Color (Agile China 2009)Agile Modeling In Color (Agile China 2009)
Agile Modeling In Color (Agile China 2009)
Vernon Stinebaker
 
re:Invent 2012 Optimizing Cassandra
re:Invent 2012 Optimizing Cassandrare:Invent 2012 Optimizing Cassandra
re:Invent 2012 Optimizing Cassandra
Ruslan Meshenberg
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)
Chris Richardson
 
A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)
Chris Richardson
 
Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)
Chris Richardson
 
Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)
Chris Richardson
 
Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)
Chris Richardson
 
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Chris Richardson
 
Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)
Chris Richardson
 

Viewers also liked (10)

Building Rich Domain Models
Building Rich Domain ModelsBuilding Rich Domain Models
Building Rich Domain Models
 
Agile Modeling In Color (Agile China 2009)
Agile Modeling In Color (Agile China 2009)Agile Modeling In Color (Agile China 2009)
Agile Modeling In Color (Agile China 2009)
 
re:Invent 2012 Optimizing Cassandra
re:Invent 2012 Optimizing Cassandrare:Invent 2012 Optimizing Cassandra
re:Invent 2012 Optimizing Cassandra
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)
 
A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)
 
Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)
 
Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)Microservices + Events + Docker = A Perfect Trio (dockercon)
Microservices + Events + Docker = A Perfect Trio (dockercon)
 
Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)Developing microservices with aggregates (SpringOne platform, #s1p)
Developing microservices with aggregates (SpringOne platform, #s1p)
 
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
 
Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)Developing microservices with aggregates (devnexus2017)
Developing microservices with aggregates (devnexus2017)
 

Similar to Applying Domain-Driven Design to craft Rich Domain Models

Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
Asher Sterkin
 
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
AugmentedWorldExpo
 
Azr infotech services
Azr infotech servicesAzr infotech services
Azr infotech services
Khursheed Farooq
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Mojammel Haque
 
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
TechSoup
 
Insurance - Open Source Analytics Dashboards for Real Time Business Overview
Insurance - Open Source Analytics Dashboards for Real Time Business OverviewInsurance - Open Source Analytics Dashboards for Real Time Business Overview
Insurance - Open Source Analytics Dashboards for Real Time Business Overview
Euro IT Group
 
DOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGNDOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGN
Mohammed Fazuluddin
 
Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
Frank Levering
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
Chris Renner
 
SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?
Nicolas Georgeault
 
SPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDSSPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDS
Nicolas Georgeault
 
Hybrid Cloud A Journey to the Cloud by Peter Hellemans
Hybrid Cloud A Journey to the Cloud by Peter HellemansHybrid Cloud A Journey to the Cloud by Peter Hellemans
Hybrid Cloud A Journey to the Cloud by Peter Hellemans
NRB
 
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
 
Big Data Analyst at BankofAmerica
Big Data Analyst at BankofAmericaBig Data Analyst at BankofAmerica
Big Data Analyst at BankofAmerica
Ganaparthi Jagadeesh
 
Arch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptxArch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptx
Sanjoy Kumar Roy
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In Design
Sandro Mancuso
 
Dezyne Technologies Corporate Profile 2016 v1.2
Dezyne Technologies Corporate Profile 2016 v1.2Dezyne Technologies Corporate Profile 2016 v1.2
Dezyne Technologies Corporate Profile 2016 v1.2Dheeraj Kaushik
 
Sphere 3D presentation for Credit Suisse technology conference 2014
Sphere 3D presentation for Credit Suisse technology conference 2014Sphere 3D presentation for Credit Suisse technology conference 2014
Sphere 3D presentation for Credit Suisse technology conference 2014
Peter Bookman
 
It resource us signal cloud presentation itr - final
It resource   us signal cloud presentation itr - finalIt resource   us signal cloud presentation itr - final
It resource us signal cloud presentation itr - finalsvanelderen
 

Similar to Applying Domain-Driven Design to craft Rich Domain Models (20)

Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
 
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
Allan Cook (Deloitte Consulting): How Do I Sell a “First” VR/AR Project to My...
 
Azr infotech services
Azr infotech servicesAzr infotech services
Azr infotech services
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
Webinar: 5 Clear Steps to Get Your Nonprofit Cloud Ready - 2018-5-31
 
Insurance - Open Source Analytics Dashboards for Real Time Business Overview
Insurance - Open Source Analytics Dashboards for Real Time Business OverviewInsurance - Open Source Analytics Dashboards for Real Time Business Overview
Insurance - Open Source Analytics Dashboards for Real Time Business Overview
 
DOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGNDOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGN
 
Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
 
SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?SPSChicagoBurbs 2019 - What is CDM and CDS?
SPSChicagoBurbs 2019 - What is CDM and CDS?
 
SPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDSSPS Vancouver 2018 - What is CDM and CDS
SPS Vancouver 2018 - What is CDM and CDS
 
Sambasiva Suresh Kumar (1)
Sambasiva Suresh Kumar (1)Sambasiva Suresh Kumar (1)
Sambasiva Suresh Kumar (1)
 
Hybrid Cloud A Journey to the Cloud by Peter Hellemans
Hybrid Cloud A Journey to the Cloud by Peter HellemansHybrid Cloud A Journey to the Cloud by Peter Hellemans
Hybrid Cloud A Journey to the Cloud by Peter Hellemans
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
 
Big Data Analyst at BankofAmerica
Big Data Analyst at BankofAmericaBig Data Analyst at BankofAmerica
Big Data Analyst at BankofAmerica
 
Arch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptxArch CoP - Domain Driven Design.pptx
Arch CoP - Domain Driven Design.pptx
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In Design
 
Dezyne Technologies Corporate Profile 2016 v1.2
Dezyne Technologies Corporate Profile 2016 v1.2Dezyne Technologies Corporate Profile 2016 v1.2
Dezyne Technologies Corporate Profile 2016 v1.2
 
Sphere 3D presentation for Credit Suisse technology conference 2014
Sphere 3D presentation for Credit Suisse technology conference 2014Sphere 3D presentation for Credit Suisse technology conference 2014
Sphere 3D presentation for Credit Suisse technology conference 2014
 
It resource us signal cloud presentation itr - final
It resource   us signal cloud presentation itr - finalIt resource   us signal cloud presentation itr - final
It resource us signal cloud presentation itr - final
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

Applying Domain-Driven Design to craft Rich Domain Models

  • 1. Applying Domain-Driven Design to craft Rich Domain Models Alexander van Trijffel Templates Powerpoint 6-2-2014
  • 2. Agenda • • • • • • What is a domain model? Hexagonal Architecture Ubiquitous Language When to use Domain-Driven Design? Adding behavior to the domain model Value objects
  • 3. The domain model Represents business objects, operations and events that reflect the business processes and are meaningful to the business representatives. Business rules ‘An Asset Value Correlation multiplier must be applied for exposures with to Financial Sector Entities with assets of at least $100 bn’ ‘In case no Country of Risk is registered in UCI, the C-rating should be ‘No Rating’ Behavior ‘When an assessment is activated, a Global Facility Id is requested from UFI and assigned to the assessment’ ‘When an employee states that he has outside interests, the system accepts stock positions under certain conditions’
  • 4. Invariants ‘A confirmed assessment has been calculated’ ‘An activated assessment has a GFID’ ‘A counterparty has an Wwid’ ‘A protection covers at least one debtor’
  • 8. Second Page : "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." Do we speak the same language?
  • 12. And our managers/services/* know all about the logic… * enter your favorite name for the application service role here
  • 13. We have a separate business layer
  • 15. When to invest in developing an ubiquitous language and implementing a Rich Domain Model? System type Domain logic Complexity Use cases DDD pays off? CRUD, Master data, Lookup Low Any No Simple, Small, Utility Low < 30 No Departmental, Narrow scoped Medium between 30 and 40 Could be Innovative Unknown ? Yes Enterprise System, Core system High > 40 Yes
  • 16. Object Oriented Software: • Encapsulates data and operations in objects that interact with each other via the object’s interface. • Applies information hiding; Internal representation of objects is hidden to clients Object oriented means that an object manages its state and guarantees that it is in a legal state at any time.
  • 17. By applying Object Orientation to the domain model, the model: • can ensure that its state is correct at all times • can hide complexity behind its public interface
  • 20. What if we have business rules on the client Status as well? Things get messy quickly…
  • 21. Empowering the domain: Encapsulating data and operations in domain objects
  • 22. Encapsulating domain logic in value objects
  • 23. Value object – immutable and comparable by its attributes
  • 24. Model object as Entity or Value Object? Entity Value object Unique Can have many occurences Distinguished by identity Distinguished by attributes Can be changed Immutable
  • 25. Money: Entity or value object?
  • 26. Value objects examples Percentage Probability of Default Loss Given Default World Wide Id Global Facility Id Rating Address Country Decision Period Status
  • 27. Other tactical DDD patterns to explore: • Domain Services • Domain Events • Aggregates
  • 28. Summary Domain-Driven Design is a methodology that provides patterns for designing rich domains that encapsulate data and behavior. The investment in developing an ubiquitous language and implementing a rich domain model pays off for medium to large applications that implement business rules and processes. By applying Object Oriented principles to the domain, business logic is easier to test, understand and extend.
  • 30. Resources • Domain-Driven Design: Tackling Complexity in the Heart of Software (Eric Evans) • Implementing Domain-Driven Design Vaughn Vernon • DDD/CQRS mailing list https://groups.google.com/forum/#!forum/dddcqrs
  • 32. Empowering the domain: Constructing objects What does it mean to be a client in our domain? • Does a client without a wwid make sense? • Does our domain even support clients without ratings? Communicate the intent of a client through the API:
  • 33. Empowering the domain: Encapsulated collections Can the domain object guarantee that the Ratings collection is valid at all times? Does it make sense to clear all ratings? Duplicate a rating?
  • 34. Empowering the domain: Encapsulated collections We provide an explicit API to manipulate the collection.

Editor's Notes

  1. Rich Domain ModelsThe domain model is an abstraction of the problem domain that your system supports. It contains the objects and operations that are crucial to your system and its users. Therefore the design of the domain model deserves the utmost care and attention. In this session Alexander will demonstrate how to put Domain-Driven Design (DDD) in practice. We will explore how to apply DDD on tactical level to design a rich domain model that encapsulates behaviour, protects its invariants and can be tested in isolation from its runtime environment.
  2. An invariant is a logical assertion that is held to always be true during a certain phase of execution
  3. Alistair Cockburn, 2005Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.
  4. Released in 2003DDD is a methodology for designing domain models using an object oriented approach.
  5. Business talks about clients, ratings, regulatory reportingDevelopers talk about XSDs, inserting database records, repositories, factories.
  6. Do you business users talk about Assigning an WWID, Creating an WWID or adding a long id to the Client database?Capture the nouns and the verbs and have your domain model and code reflect the names used by the business to prevent translations
  7. An anemic model is a domain model that doesn&apos;t contain any logic. That is why the model is called anemic. It is just a container for data that can be changed and interpreted by clients. Therefore all logic is placed outside the domain models in an anemic model.An anemic model can never guarantee it&apos;s correctness at any time. An anemic model has no logic that ensures that it is in a legal state at any time.. The main problem with anemic models is that they are contradictory with fundamental object-oriented principles like: encapsulation, information hiding and bringing data and process (logic) together.Procedural programming is straight forward to write, but hard to understand if you want to understand the state handling of an application.In a behavior-rich, but anemic domain, the domain is surrounded by a multitude of services that do the actual work, and fiddle with state on our domain objects.  The domain objects contain state to be persisted, but it’s not the domain objects themselves exposing any operations
  8. Enterprise system that is vital to the business can also be bought as an off the shelf product
  9. Add methods to your domain objects for changing its internal state. If The method requires any data to implement the business rules that does not relate to the domain object, give the method access to that data.  The less developers you exposure the intricacies of your domain, the easier it is to ensure that the business logic will be applied correctly. For all usage scenario’s =&gt; web services, user interfaces, etcKeep the application layer thin.This layer should only be concerned with coordination: Loading an entity from the database,send a message to it, persist changes. All business logic should not be apart of the application layer.Isolate complexity. Introduce modularity.
  10. Currency + amount + serial number
  11.