SlideShare a Scribd company logo
1 of 38
Introduction to
Domain Driven Design
Ferose Khan J
01 WHY BOTHER ABOUT
DOMAIN?
Domain
“Every software program relates to some
activity or interest of its user. That subject
area to which the user applies the program
is the DOMAIN of the software.”
Story…
02 IS UNDERSTANDING
DOMAIN EASY?
Let’s have some fun
What I wanted
Crunching Knowledge
• Brainstorming
• Continuous learning
• Effective modeling
• Make concepts explicit
Communication
• Ubiquitous language
• Model out loud
• One team one language
• Documents & diagram aid communication
03 HOW TO BIND MODEL &
IMPLEMENTATION?
Problem
Analysis Model Design model
Analysis model
Module1
Module2
Module3 Module4
Module3 Module8 Module9
Module5 Module6
Design model
Where’s the problem?
Ivory tower architect
No feedback from team
Results in brave speeches in
the end
Solutions is hands-on modelers
Do Model Driven Design
• One model
• Analysis and design one iterative loop
• Design a little
• Make code an expression of model
04 WHAT ABOUT OTHER
TECHNICAL REQUIREMENTS?
Isolate the domain from them
Model lives @Domain layer
05 HOW TO EXPRESS MODEL
IN S/W?
Entities
Value Objects
Associations
Services
06 WHAT ABOUT THE LIFE
CYCLE OF DOMAIN OBJECT?
Aggregates
Factories
Repositories
07 SO WHAT?
Our Domain
Medical software
• Saves life
• Improves quality of life
Give a try
Ferose Khan Jeberla
t @ferosekhanj
d ferosekhanj.wordpress.com
l http://lnkd.in/UJry2c

More Related Content

Viewers also liked

Viewers also liked (18)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition
DDD Basics: Bounded Contexts, Modelling - Kortrijk EditionDDD Basics: Bounded Contexts, Modelling - Kortrijk Edition
DDD Basics: Bounded Contexts, Modelling - Kortrijk Edition
 
DDD & Microservices from the Front Lines: Building Evolvable Software with Ev...
DDD & Microservices from the Front Lines: Building Evolvable Software with Ev...DDD & Microservices from the Front Lines: Building Evolvable Software with Ev...
DDD & Microservices from the Front Lines: Building Evolvable Software with Ev...
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Domain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDomain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with Rails
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
Brownfield Domain Driven Design
Brownfield Domain Driven DesignBrownfield Domain Driven Design
Brownfield Domain Driven Design
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Model driven development using smart use cases and domain driven design
Model driven development using smart use cases and domain driven designModel driven development using smart use cases and domain driven design
Model driven development using smart use cases and domain driven design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
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
 
Domain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDDDomain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDD
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in php
 
Scala with DDD
Scala with DDDScala with DDD
Scala with DDD
 
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...Developing event-driven microservices with event sourcing and CQRS  (svcc, sv...
Developing event-driven microservices with event sourcing and CQRS (svcc, sv...
 

Similar to Introduction to DDD

Similar to Introduction to DDD (20)

Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15
 
Domain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic ApproachDomain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic Approach
 
Up to speed in domain driven design
Up to speed in domain driven designUp to speed in domain driven design
Up to speed in domain driven design
 
The 360 Developer
The 360 DeveloperThe 360 Developer
The 360 Developer
 
Domain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic ApproachDomain Driven Design: Made Easy employing Systemic Approach
Domain Driven Design: Made Easy employing Systemic Approach
 
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic Patterns
 
Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
 
Modeling on the Web
Modeling on the WebModeling on the Web
Modeling on the Web
 
Modeling on the Web
Modeling on the WebModeling on the Web
Modeling on the Web
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Interactive DSML Design
Interactive DSML DesignInteractive DSML Design
Interactive DSML Design
 
SADT & IDEF0 for Augmenting UML, Algile & Usability Engineering
SADT & IDEF0 for Augmenting UML, Algile & Usability EngineeringSADT & IDEF0 for Augmenting UML, Algile & Usability Engineering
SADT & IDEF0 for Augmenting UML, Algile & Usability Engineering
 
Domain specific modelling (DSM)
Domain specific modelling (DSM)Domain specific modelling (DSM)
Domain specific modelling (DSM)
 
The Role of the Architect
The Role of the ArchitectThe Role of the Architect
The Role of the Architect
 
Introduction
IntroductionIntroduction
Introduction
 
Modeling should be an independent scientific discipline
Modeling should be an independent scientific disciplineModeling should be an independent scientific discipline
Modeling should be an independent scientific discipline
 
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Domain Driven Design Ruby Ways -  JURNAL 05/10/2017Domain Driven Design Ruby Ways -  JURNAL 05/10/2017
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
 
Kevin Whinnery: Best Practices for Cross-Platform Mobile Development
Kevin Whinnery: Best Practices for Cross-Platform Mobile DevelopmentKevin Whinnery: Best Practices for Cross-Platform Mobile Development
Kevin Whinnery: Best Practices for Cross-Platform Mobile Development
 
Domain Driven Design and Model Driven Software Development
Domain Driven Design and Model Driven Software DevelopmentDomain Driven Design and Model Driven Software Development
Domain Driven Design and Model Driven Software Development
 
It is a sunny day
It is a sunny dayIt is a sunny day
It is a sunny day
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Introduction to DDD

Editor's Notes

  1. What is a domain? With respect to software development. The user applies the program to solve some problem. The area where he applies is the domain.
  2. My sister bought a LG viewty long time back. It was a remarkable phone at that time. It had full touch screen, 5MP camera with digital image stabilization, excellent audio and music features, Built in office sw Etc., But she had one important problem. The number of calls dropped was pretty high. It did not fulfill its purpose as a phone. In the end she bought an additional phone a dumb one from nokia which did not have any of this fancy feature but it fulfilled the purpose as a phone. Similarly in software development also we have a core problem which we solve using the software. If the software is able to solve that problem well and good then it succeeds. If it performs all other functionalities excellently, but doesn't solve the core problem then it will fail.
  3. Select a participant. Provide the participant with a model. Now make 2 groups. Ask them to make the same model without disclosing them to the groups. The groups should reproduce the model just by questioning the participant.
  4. In order to come up with a solution first thing we need to know is understand the problem. Ask the domain expert regarding various clarification and distill the model. It is not a one time activity. Learning and revelations happen through out the life time of design. The models need to be deep not just a shallow one. Make sure you don’t just come up with a anemic data model. The model includes important aspects and leaves out the unimportant ones. Make the model knowledge rich. Only with careful discussion and distilling we can express the model properly in SW.
  5. Hands on modelers ivory tower architects Feedback from implementation missing Modeling & Implementation are part of modeling process Architects should do some hands on coding Designers should participate in model discussions
  6. Hands on modelers ivory tower architects Feedback from implementation missingModelling & Implementation are part of modelling process Architects should do some hands on coding\ Designers should participate in model discussions
  7. Many objects are not fundamentally defined by their attributes, but rather by a thread of continuity and identity.Some objects are not defined primarily by their attributes. They represent a thread of identity that runs through time and often across distinct representations. Sometimes such an object must be matched with another object even though attributes differ. An object must be distinguished from other objects even though they might have the same attributes. Mistaken identity can lead to data corruption.When an object is distinguished by its identity, rather than its attributes, make this primary to its definition in the model. Keep the class definition simple and focused on life cycle continuity and identity. Define a means of distinguishing each object regardless of its form or history. Be alert to requirements that call for matching objects by attributes. Define an operation that is guaranteed to produce a unique result for each object, possibly by attaching a symbol that is guaranteed unique. This means of identification may come from the outside, or it may be an arbitrary identifier created by and for the system, but it must correspond to the identity distinctions in the model. The model must define what it means to be the same thing.
  8. Many objects have no conceptual identity. These objects describe some characteristic of a thing.Tracking the identity of ENTITIES is essential, but attaching identity to other objects can hurt system performance, add analytical work, and muddle the model by making all objects look the same.Software design is a constant battle with complexity. We must make distinctions so that special handling is applied only where necessary.However, if we think of this category of object as just the absence of identity, we haven't added much to our toolbox or vocabulary. In fact, these objects have characteristics of their own and their own significance to the model. These are the objects that describe things.When you care only about the attributes of an element of the model, classify it as a VALUE OBJECT. Make it express the meaning of the attributes it conveys and give it related functionality. Treat the VALUE OBJECT as immutable. Don't give it any identity and avoid the design complexities necessary to maintain ENTITIES.
  9. There are at least three ways of making associations more tractable.Imposing a traversal directionAdding a qualifier, effectively reducing multiplicityEliminating nonessential associations
  10. The operation relates to a domain concept that is not a natural part of an ENTITY or VALUE OBJECT.The interface is defined in terms of other elements of the domain model.The operation is stateless.There are important domain operations that can't find a natural home in an ENTITY or VALUE OBJECT. Some of these are intrinsically activities or actions, not things, but since our modeling paradigm is objects, we try to fit them into objects anyway.Some concepts from the domain aren't natural to model as objects. Forcing the required domain functionality to be the responsibility of an ENTITY or VALUE either distorts the definition of a model-based object or adds meaningless artificial objects.
  11. It is difficult to guarantee the consistency of changes to objects in a model with complex associations. Invariants need to be maintained that apply to closely related groups of objects, not just discrete objects. Yet cautious locking schemes cause multiple users to interfere pointlessly with each other and make a system unusable.Cluster the ENTITIES and VALUE OBJECTS into AGGREGATES and define boundaries around each. Choose one ENTITY to be the root of each AGGREGATE, and control all access to the objects inside the boundary through the root. Allow external objects to hold references to the root only. Transient references to internal members can be passed out for use within a single operation only. Because the root controls access, it cannot be blindsided by changes to the internals. This arrangement makes it practical to enforce all invariants for objects in the AGGREGATE and for the AGGREGATE as a whole in any state change.
  12. When creation of an object, or an entire AGGREGATE, becomes complicated or reveals too much of the internal structure, FACTORIES provide encapsulation.Creation of an object can be a major operation in itself, but complex assembly operations do not fit the responsibility of the created objects. Combining such responsibilities can produce ungainly designs that are hard to understand. Making the client direct construction muddies the design of the client, breaches encapsulation of the assembled object or AGGREGATE, and overly couples the client to the implementation of the created object.
  13. Associations allow us to find an object based on its relationship to another. But we must have a starting point for a traversal to an ENTITY or VALUE in the middle of its life cycle.A client needs a practical means of acquiring references to preexisting domain objects. If the infrastructure makes it easy to do so, the developers of the client may add more traversable associations, muddling the model. On the other hand, they may use queries to pull the exact data they need from the database, or to pull a few specific objects rather than navigating from AGGREGATE roots. Domain logic moves into queries and client code, and the ENTITIES and VALUE OBJECTS become mere data containers. The sheer technical complexity of applying most database access infrastructure quickly swamps the client code, which leads developers to dumb down the domain layer, which makes the model irrelevant.
  14. Introduction about the presenter.I am ferose. I work for Siemens from 2003. Formally I was with the Oncology software development team for about 10 years. I recently joined AX. My area of expertise includes software design, architecture & 2D/3D medical image processing. I am from TN and I have a small family.