SlideShare a Scribd company logo
1 of 16
Domain Driven
Design
What it is and what it is not?
•   "Domain" not like in "part of the URL", but like in "area of business
    expertise"
•   Wikipedia: (http://en.wikipedia.org/wiki/Domain-driven_design)
    Domain-driven design (DDD) is an approach to developing software for
    complex needs by deeply connecting the implementation to an
    evolving model of the core business concepts. The premise of domain-
    driven design is the following:
     o Placing the project's primary focus on the core domain and domain
         logic
     o Basing complex designs on a model
     o Initiating a creative collaboration between technical and domain
         experts to iteratively cut ever closer to the conceptual heart of the
         problem.
     o 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.
Core definitions
Domain: A sphere of knowledge (ontology), influence, or activity. The subject

•
  area to which the user applies a program is the domain of the software.
    Model: A system of abstractions that describes selected aspects of a

•
    domain and can be used to solve problems related to that domain.
    Ubiquitous Language: A language structured around the domain model
    and used by all team members to connect all the activities of the team

•
    with the software.
    Context: The setting in which a word or statement appears that
    determines its meaning.
Building blocks of the model
In DDD, there are artifacts to express, create, and retrieve domain models:
 •   Entity: An object that is not defined by its attributes, but rather by a thread of
     continuity and its identity.
 •   Value Object: An object that contains attributes but has no conceptual identity.
     They should be treated as immutable.
 •   Aggregate: A collection of objects that are bound together by a root
     entity, otherwise known as an aggregate root. The aggregate root guarantees the
     consistency of changes being made within the aggregate by forbidding external
     objects from holding references to its members.
 •   Service: When an operation does not conceptually belong to any object.
     Following the natural contours of the problem, you can implement these operations
     in services.
 •   Repository: methods for retrieving domain objects should delegate to a
     specialized Repository object such that alternative storage implementations may be
     easily interchanged.
 •   Factory: methods for creating domain objects should delegate to a specialized
     Factory object such that alternative implementations may be easily interchanged.
Ubiquitous language
meaning that the domain model should form a
 common language given by domain experts
 for describing system requirements, that
 works equally well for the business users
 or sponsors and for the software developers
Context
Multiple models are in play on any large project.
   Yet when code based on distinct models is combined, software becomes
   buggy, unreliable, and difficult to understand. Communication among team
   members becomes confused. It is often unclear in what context a model
   should not be applied.


•
Therefore:


•
    Explicitly define the context within which a model applies.
    Explicitly set boundaries in terms of team organization, usage within
    specific parts of the application, and physical manifestations such as code

•
    bases and database schemas.
    Keep the model strictly consistent within these bounds, but don’t be
    distracted or confused by issues outside.
The modeling process flow
•
•
    Model and document business processes first.
    Select a candidate business process and work with the business domain

•
    experts to document it using the Ubiquitous Language.
    Identify all the services that are required for the candidate business
    process. These services can be atomic (single step) or orchestrated (multi-
    step with or without work-flow) in nature. They can also be business (e.g.

•
    Underwriting or Funding) or infrastructure (e.g. E-mail or Job Scheduling).
    Identify and document the state and behavior of the objects used by
    services identified in the previous step.
Architecture
A typical enterprise application architecture consists of the following four

•
    conceptual layers:
    User Interface (Presentation Layer): Responsible for presenting

•
    information to the user and interpreting user commands.
    Application Layer: This layer coordinates the application activity. It
    doesn't contain any business logic. It does not hold the state of business

•
    objects, but it can hold the state of an application task's progress.
    Domain Layer: This layer contains information about the business
    domain. The state of business objects is held here. Persistence of the
    business objects and possibly their state is delegated to the infrastructure

•
    layer.
    Infrastructure Layer: This layer acts as a supporting library for all the
    other layers. It provides communication between layers, implements
    persistence for business objects, contains supporting libraries for the user
    interface layer, etc.
Application layer
•   is responsible for the navigation between the UI screens in the application

•
    as well as the interaction with the application layers of other systems.
    can also perform the basic (non-business related) validation on the user
    input data before transmitting it to the other (lower) layers of the

•
    application.


•
    doesn't contain any business or domain related logic or data access logic.
    doesn't have any state reflecting a business use case but it can manage
    the state of the user session or the progress of a task.
Domain layer
•   is responsible for the concepts of business domain, information about the
    business use case and the business rules. Domain objects encapsulate

•
    the state and behavior of business entities.
    can also manage the state (session) of a business use case if the use
    case spans multiple user requests (e.g. loan registration process which
    consists of multiple steps: user entering the loan details, system returning
    the products and rates based on the loan parameters, user selecting a
    specific product/rate combination, and finally the system locking the loan

•
    for that rate).
    contains service objects that only have a defined operational behavior
    which is not part of any domain object. Services encapsulate behavior of

•
    the business domain that doesn't fit in the domain objects themselves.
    is the heart of the business application and should be well isolated from
    the other layers of the application. Also, it should not be dependent on the
    application frameworks used in the other layers
Design concepts
Following design aspects are considered as the main ingredients of the current
    DDD implementation recipe:


•
•
    Object Oriented Programming (OOP)


•
    Dependency Injection (DI)
    Aspect Oriented Programming (AOP)
The project flow
From a project management standpoint, a real-world DDD implementation
   project comprises the same phases as any other software development
   project.


•
These phases include:


•
    Model the domain


•
    Design


•
    Development


•
    Unit and Integration Testing
    Refine and refactor the domain model based on the design and

•
    development (Continuous Integration (CI) of model concepts).
    Repeat the above steps using the updated domain model (CI of domain
    implementation).
Benefits
•   It helps the team create a common model, between the business and IT
    stakeholders in the company, that the team can use to communicate about

•
    the business requirements, data entities, and process models.
    The model is modular, extensible and easy to maintain as the design

•
    reflects the business model.
    It improves the reusability and testability of the business domain objects.
Prerequisites for the
successful application of DDD
•
•
    Your domain is not trivial
    The project team has experience and interest in Object Oriented

•
    Programming/Design


•
    You have access to domain experts
    You have an iterative process
Resources
http://en.wikipedia.org/wiki/Domain-driven_design
http://www.infoq.com/articles/ddd-in-practice
http://en.wikipedia.org/wiki/Object-oriented_programming
http://en.wikipedia.org/wiki/Dependency_injection
http://en.wikipedia.org/wiki/Aspect-oriented_programming
http://www.udidahan.com/2007/04/21/domain-model-pattern/
http://en.wikipedia.org/wiki/Unified_Modeling_Language




•
Books:
     Domain-Driven Design, Tackling Complexity in the Heart of Software, Eric Evans, Addison

•
•
     Wesley
     Applying Domain-Driven Design and Patterns, Jimmy Nilsson, Addison Wesley
     Refactoring to Patterns, Joshua Kerievsky, Addison Wesley

More Related Content

What's hot

What's hot (20)

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 (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
Scrum + bdd + ddd
Scrum + bdd + dddScrum + bdd + ddd
Scrum + bdd + ddd
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overview
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
stupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdfstupid-simple-kubernetes-final.pdf
stupid-simple-kubernetes-final.pdf
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Azure dev ops
Azure dev opsAzure dev ops
Azure dev ops
 

Similar to Domain Driven Design

Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
Software design for scientific applications
Software design for scientific applicationsSoftware design for scientific applications
Software design for scientific applications
Priyanka Lal
 

Similar to Domain Driven Design (20)

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"
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Non-functional requirements
Non-functional requirements Non-functional requirements
Non-functional requirements
 
Private cloud reference model ms
Private cloud reference model msPrivate cloud reference model ms
Private cloud reference model ms
 
Oracle Forms Modernization Roadmap
Oracle Forms Modernization RoadmapOracle Forms Modernization Roadmap
Oracle Forms Modernization Roadmap
 
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
 
Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
 
Unit_1(Software and Software Engineering).pptx
Unit_1(Software and Software Engineering).pptxUnit_1(Software and Software Engineering).pptx
Unit_1(Software and Software Engineering).pptx
 
Design Engineering and Design concepts
Design Engineering and Design conceptsDesign Engineering and Design concepts
Design Engineering and Design concepts
 
Design Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptxDesign Concepts in Software Engineering-1.pptx
Design Concepts in Software Engineering-1.pptx
 
DevOps Introduction - Main Concepts Description
DevOps Introduction - Main Concepts DescriptionDevOps Introduction - Main Concepts Description
DevOps Introduction - Main Concepts Description
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In Design
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
OOSE UNIT-1.pdf
OOSE UNIT-1.pdfOOSE UNIT-1.pdf
OOSE UNIT-1.pdf
 
Development Guideline
Development GuidelineDevelopment Guideline
Development Guideline
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Android ppt with example of budget manager
Android ppt with example of budget managerAndroid ppt with example of budget manager
Android ppt with example of budget manager
 
Software design for scientific applications
Software design for scientific applicationsSoftware design for scientific applications
Software design for scientific applications
 
SDWest2005Goetsch
SDWest2005GoetschSDWest2005Goetsch
SDWest2005Goetsch
 

Recently uploaded

9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
delhimodel235
 
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
ApartmentWala1
 
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In DelhiCall Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
asmaqueen5
 
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
delhimodel235
 
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
soniya singh
 
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
delhimodel235
 
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
soniya singh
 
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
delhimodel235
 
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 

Recently uploaded (20)

9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 6 Delhi (Call Girls) Delhi
 
M3M 129 E Brochure Noida Expressway, Sector 129, Noida
M3M 129 E Brochure Noida Expressway, Sector 129, NoidaM3M 129 E Brochure Noida Expressway, Sector 129, Noida
M3M 129 E Brochure Noida Expressway, Sector 129, Noida
 
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
Best Deal Virtual Space in Satya The Hive Tata Zudio 750 Sqft 1.89 Cr All inc...
 
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In DelhiCall Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
Call Girls In Mayur Vihar Delhi ☆↫8447779280 ❤Escorts Service In Delhi
 
Greater Vancouver Realtors Statistics Package April 2024
Greater Vancouver Realtors Statistics Package April 2024Greater Vancouver Realtors Statistics Package April 2024
Greater Vancouver Realtors Statistics Package April 2024
 
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 137 Noida (Call Girls) Delhi
 
3D Architectural Rendering Company by Panoram CGI
3D Architectural Rendering Company by Panoram CGI3D Architectural Rendering Company by Panoram CGI
3D Architectural Rendering Company by Panoram CGI
 
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
call girls in ganesh nagar Delhi 8264348440 ✅ call girls ❤️
 
BDSM⚡Call Girls in Sector 57 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 57 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 57 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 57 Noida Escorts >༒8448380779 Escort Service
 
M3M The Line Brochure - Premium Investment Opportunity for Commercial Ventures
M3M The Line Brochure - Premium Investment Opportunity for Commercial VenturesM3M The Line Brochure - Premium Investment Opportunity for Commercial Ventures
M3M The Line Brochure - Premium Investment Opportunity for Commercial Ventures
 
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 2 Delhi (Call Girls) Delhi
 
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in shastri nagar Delhi 8264348440 ✅ call girls ❤️
 
Majestique Viman Nagar Pune Brochure.pdf
Majestique Viman Nagar Pune Brochure.pdfMajestique Viman Nagar Pune Brochure.pdf
Majestique Viman Nagar Pune Brochure.pdf
 
Premium Villa Projects in Sarjapur Road Bengaluru
Premium Villa Projects in Sarjapur Road BengaluruPremium Villa Projects in Sarjapur Road Bengaluru
Premium Villa Projects in Sarjapur Road Bengaluru
 
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
9990771857 Call Girls in Dwarka Sector 7 Delhi (Call Girls) Delhi
 
TENANT SCREENING REPORT SERVICES​ How Tenant Screening Reports Work
TENANT SCREENING REPORT SERVICES​ How Tenant Screening Reports WorkTENANT SCREENING REPORT SERVICES​ How Tenant Screening Reports Work
TENANT SCREENING REPORT SERVICES​ How Tenant Screening Reports Work
 
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
Maha Mauka Squarefeet Brochure |Maha Mauka Squarefeet PDF Brochure|
 
Shapoorji Pallonji Joyville Vista Pune | Spend Your Family Time Together
Shapoorji Pallonji Joyville Vista Pune | Spend Your Family Time TogetherShapoorji Pallonji Joyville Vista Pune | Spend Your Family Time Together
Shapoorji Pallonji Joyville Vista Pune | Spend Your Family Time Together
 
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Vasant Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Kohinoor Hinjewadi Phase 2 Pune E-Brochure.pdf
Kohinoor Hinjewadi Phase 2 Pune  E-Brochure.pdfKohinoor Hinjewadi Phase 2 Pune  E-Brochure.pdf
Kohinoor Hinjewadi Phase 2 Pune E-Brochure.pdf
 

Domain Driven Design

  • 2. What it is and what it is not? • "Domain" not like in "part of the URL", but like in "area of business expertise" • Wikipedia: (http://en.wikipedia.org/wiki/Domain-driven_design) Domain-driven design (DDD) is an approach to developing software for complex needs by deeply connecting the implementation to an evolving model of the core business concepts. The premise of domain- driven design is the following: o Placing the project's primary focus on the core domain and domain logic o Basing complex designs on a model o Initiating a creative collaboration between technical and domain experts to iteratively cut ever closer to the conceptual heart of the problem. o 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.
  • 3. Core definitions Domain: A sphere of knowledge (ontology), influence, or activity. The subject • area to which the user applies a program is the domain of the software. Model: A system of abstractions that describes selected aspects of a • domain and can be used to solve problems related to that domain. Ubiquitous Language: A language structured around the domain model and used by all team members to connect all the activities of the team • with the software. Context: The setting in which a word or statement appears that determines its meaning.
  • 4. Building blocks of the model In DDD, there are artifacts to express, create, and retrieve domain models: • Entity: An object that is not defined by its attributes, but rather by a thread of continuity and its identity. • Value Object: An object that contains attributes but has no conceptual identity. They should be treated as immutable. • Aggregate: A collection of objects that are bound together by a root entity, otherwise known as an aggregate root. The aggregate root guarantees the consistency of changes being made within the aggregate by forbidding external objects from holding references to its members. • Service: When an operation does not conceptually belong to any object. Following the natural contours of the problem, you can implement these operations in services. • Repository: methods for retrieving domain objects should delegate to a specialized Repository object such that alternative storage implementations may be easily interchanged. • Factory: methods for creating domain objects should delegate to a specialized Factory object such that alternative implementations may be easily interchanged.
  • 5. Ubiquitous language meaning that the domain model should form a common language given by domain experts for describing system requirements, that works equally well for the business users or sponsors and for the software developers
  • 6. Context Multiple models are in play on any large project. Yet when code based on distinct models is combined, software becomes buggy, unreliable, and difficult to understand. Communication among team members becomes confused. It is often unclear in what context a model should not be applied. • Therefore: • Explicitly define the context within which a model applies. Explicitly set boundaries in terms of team organization, usage within specific parts of the application, and physical manifestations such as code • bases and database schemas. Keep the model strictly consistent within these bounds, but don’t be distracted or confused by issues outside.
  • 7. The modeling process flow • • Model and document business processes first. Select a candidate business process and work with the business domain • experts to document it using the Ubiquitous Language. Identify all the services that are required for the candidate business process. These services can be atomic (single step) or orchestrated (multi- step with or without work-flow) in nature. They can also be business (e.g. • Underwriting or Funding) or infrastructure (e.g. E-mail or Job Scheduling). Identify and document the state and behavior of the objects used by services identified in the previous step.
  • 8. Architecture A typical enterprise application architecture consists of the following four • conceptual layers: User Interface (Presentation Layer): Responsible for presenting • information to the user and interpreting user commands. Application Layer: This layer coordinates the application activity. It doesn't contain any business logic. It does not hold the state of business • objects, but it can hold the state of an application task's progress. Domain Layer: This layer contains information about the business domain. The state of business objects is held here. Persistence of the business objects and possibly their state is delegated to the infrastructure • layer. Infrastructure Layer: This layer acts as a supporting library for all the other layers. It provides communication between layers, implements persistence for business objects, contains supporting libraries for the user interface layer, etc.
  • 9. Application layer • is responsible for the navigation between the UI screens in the application • as well as the interaction with the application layers of other systems. can also perform the basic (non-business related) validation on the user input data before transmitting it to the other (lower) layers of the • application. • doesn't contain any business or domain related logic or data access logic. doesn't have any state reflecting a business use case but it can manage the state of the user session or the progress of a task.
  • 10. Domain layer • is responsible for the concepts of business domain, information about the business use case and the business rules. Domain objects encapsulate • the state and behavior of business entities. can also manage the state (session) of a business use case if the use case spans multiple user requests (e.g. loan registration process which consists of multiple steps: user entering the loan details, system returning the products and rates based on the loan parameters, user selecting a specific product/rate combination, and finally the system locking the loan • for that rate). contains service objects that only have a defined operational behavior which is not part of any domain object. Services encapsulate behavior of • the business domain that doesn't fit in the domain objects themselves. is the heart of the business application and should be well isolated from the other layers of the application. Also, it should not be dependent on the application frameworks used in the other layers
  • 11. Design concepts Following design aspects are considered as the main ingredients of the current DDD implementation recipe: • • Object Oriented Programming (OOP) • Dependency Injection (DI) Aspect Oriented Programming (AOP)
  • 12. The project flow From a project management standpoint, a real-world DDD implementation project comprises the same phases as any other software development project. • These phases include: • Model the domain • Design • Development • Unit and Integration Testing Refine and refactor the domain model based on the design and • development (Continuous Integration (CI) of model concepts). Repeat the above steps using the updated domain model (CI of domain implementation).
  • 13.
  • 14. Benefits • It helps the team create a common model, between the business and IT stakeholders in the company, that the team can use to communicate about • the business requirements, data entities, and process models. The model is modular, extensible and easy to maintain as the design • reflects the business model. It improves the reusability and testability of the business domain objects.
  • 15. Prerequisites for the successful application of DDD • • Your domain is not trivial The project team has experience and interest in Object Oriented • Programming/Design • You have access to domain experts You have an iterative process