SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
The Domain Driven Design and
the Hexagonal Architecture
Auxenta Tech Talk ­ June 2017
Crishantha Nanayakkara
(@crishantha)
2
The Strategic Design
   
Domain Driven Design (DDD)
   
Domain Driven Design (DDD)
 
5
Bounded Context
● It is a “Strategic Design Pattern”.
● It describes a “Semantic Contextual Boundary”.
– Within the boundary, each component of the 
software model has a specific meaning and does 
specific things.
6
Core Domain(s)
● An Enterprise consists of multiple “Core Domain(s)”
● Core Domain = Bounded Context
● The boundary is completely determined by the Core 
Domain owner
● Each Core Domain / Bounded Context, consists of
– A source code repository
– A database
– Set of Concepts
7
Bounded Context
The original set of Concepts
8
Bounded Context
The Concepts are kept on getting added
9
Bounded Context
The “Big Ball of Mud”
10
Bounded Context
● While selecting the Core Domain/ Bounded Context it is 
important to give the FOCUS on the business complexity 
than the technical complexity
● Hence, it is required the developers to dig into the business 
model along with Domain Experts!
11
Ubiquitous Language
● In DDD, finding the correct Ubiquitous Language is 
important to find the “In Context” and the “Out Context”
● It is not about finding only nouns in the context
● It is about finding the scenarios in the context
● Scenarios are not the typical use cases that you find in the 
OOD
12
● In a DDD project, there can be multiple “Bounded 
Contexts”.
● In a DDD project, a “Bounded Context” should align 1:1 
with a single “Sub Domain”
● A “Sub Domain” is a sub­part of your overall business 
domain. 
● There are three primary types of Sub Domains in an 
Enterprise.
– Core Domain
– Supporting Domain
– Generic Domain
Sub Domains
13
● There are six sub domains in the following including the 
Core Domain, which is the “Agile Project Management 
Core”
Sub Domains
14
● When one Bounded Context is integrate with some other 
Bounded Context, this integration is known as the “Context 
Mapping”
Context Mapping
15
● Partnership
● Shared Kernel
● Customer­Supplier
● Conformist
● Anti­corruption Layer
● Open Host Service
● Published Language
● Separate Ways
Context Mapping Types
16
● Partnership
– Two teams create a partnership with a dependent 
set of goals
– Two teams will succeed or fail together
– The partnership will succeed as long as the 
commitment lies between both parties
Context Mapping Types
17
● Shared Kernel
– Two teams share a small but a common model
– Often difficult to manage
Context Mapping Types
18
● Customer­Supplier
– Supplier (Upstream); Customer (Downstream)
– Supplier decides what the customer gets
Context Mapping Types
19
● Conformist
– A Customer­Supplier type
– Downstream model should conform to the 
Upstream model always
Context Mapping Types
20
● Anti­Corruption Layer
– The layer isolates the Upstream model from the 
Downstream model and translates between the 
two
Context Mapping Types
21
● Open Host Service / Published Language
– The host defines the interface as an API and it 
can be consumed by any customer
– This is a much better method compared to others
– The “Published Language” is when you are using 
a standard interface, such as WSDL or JSON
Context Mapping Types
22
● Separate Ways
– There is no connection between two bounded 
contexts
Context Mapping Types
23
Aggregate
● There are two Bounded Contexts here
● Each Bounded Context has got multiple Aggregates 
– e.g. The “Product”, “Backlog Item”, “Release”, 
“Sprint” are aggregates on the left Bounded 
Context 
24
● Aggregate is a pattern in DDD, which is a cluster of 
domain objects that can be treated as a single unit 
● One of its component objects be the “aggregate root”
● The aggregate root can ensure the integrity of the 
aggregate as a whole
Aggregate
25
● Each aggregate forms a transactional consistency boundary
● Only one aggregate should be committed in a single 
transaction (The general rule in the aggregate design)
● Any other aggregate should be committed in a separate 
transaction
Aggregate
26
● Design Small Aggregates and eliminate large aggregates
● Smaller aggregates are easier to work on and scalable
● Follows the SRP (Single Responsibility Principle)
Aggregate
27
● Reference other aggregates by Identity only. Helps to keep 
Aggregates small and prevents reaching out to modify 
multiple aggregates in the same transaction
● Lower memory requirement and quicker loading from the 
persistent store
● Facilitates multiple persistence stores such as Relational 
Databases, Document Databases, Key Value Stores
Aggregate
28
● Updating the other Aggregates using “Domain Events”
Aggregate
29
● Updating the other Aggregates using “Domain Events” and 
a “Messaging Mechanism”
Aggregates and Domain Events
30
● Though both Aggregates are in the same Bounded Context, 
it is easy to use the same Messaging Middleware to do the 
eventing, which probably used for messaging between 
Bounded Contexts
Domain Events
31
The Hexagonal Architecture
(Ports and Adapters)
● This is known as the fundamental architecture in DDD. 
● It is an “Architecture Style”, also known as the “Ports and 
Adapters” 
● An extension to the traditional “layered architecture”, 
which has one directional thinking and mostly all the 
dependencies go in one direction
● It talks about the distinction between the softwares’ inside 
and outside parts
– Inside Part: the Domain model
– Outside Part : UI, Database and Messaging
32
The Three Components
● There are 3 main components
– Domain Model
– Ports
– Adapters
● Domain Model 
– A conceptual model, a representation of 
meaningful concepts to the domain that need to be 
modeled in software
33
The Three Components
● Ports
– Primary Ports
● Main APIs/ Interfaces of the application.
● They are called by the Primary Adapters
– Secondary Ports
● APIs/ Interfaces for the Secondary Adapters
● They are called by the Core Logic
34
The Three Components
● Adapter is a bridge between the application and the port / 
service
● Adapters
– Primary Adapter – A piece of code between the 
user and the core logic and interact with the 
Primary port
– Secondary Adapter – Interacts with the Secondary 
port
35
The Architecture
36
The Architecture
37
References
● Domain Driven Design Distilled – By Vaughn Vernon
● https://www.thoughtworks.com/insights/blog/domain-driven-design-se
rvices-architecture
● https://dzone.com/refcardz/getting-started-domain-driven
   
Thank YouThank You
Crishantha NanayakkaraCrishantha Nanayakkara
Director – Technology, AuxentaDirector – Technology, Auxenta
email: crishantha@auxenta.comemail: crishantha@auxenta.com
Twitter: @crishanthaTwitter: @crishantha
Blog : Blog : www.crishantha.comwww.crishantha.com
LinkedIn: http://linkedin.com/in/crishanthaLinkedIn: http://linkedin.com/in/crishantha

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven development
 
DDD - 1 - A gentle introduction to Domain Driven Design.pdf
DDD - 1 - A gentle introduction to Domain Driven Design.pdfDDD - 1 - A gentle introduction to Domain Driven Design.pdf
DDD - 1 - A gentle introduction to Domain Driven Design.pdf
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
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
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design – DDD além da teoria!, por Paulo Victor Gomes
Domain Driven Design – DDD além da teoria!, por Paulo Victor GomesDomain Driven Design – DDD além da teoria!, por Paulo Victor Gomes
Domain Driven Design – DDD além da teoria!, por Paulo Victor Gomes
 
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
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
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
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain Models
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 

Similar a Domain Driven Design and Hexagonal Architecture

New businessproposal ver5
New businessproposal ver5New businessproposal ver5
New businessproposal ver5
MPLLC
 
Sushma Singh-Resume
Sushma Singh-ResumeSushma Singh-Resume
Sushma Singh-Resume
Sushma singh
 

Similar a Domain Driven Design and Hexagonal Architecture (20)

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 DRIVER DESIGN
DOMAIN DRIVER DESIGNDOMAIN DRIVER DESIGN
DOMAIN DRIVER DESIGN
 
DDD knowledge sharing
DDD knowledge sharingDDD knowledge sharing
DDD knowledge sharing
 
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
 
2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it
 
Planning Your Career: The Journey
Planning Your Career: The JourneyPlanning Your Career: The Journey
Planning Your Career: The Journey
 
Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
 
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven Architectures
 
Feedback on DDD Europe - short -event storming.pptx
Feedback on DDD Europe - short -event storming.pptxFeedback on DDD Europe - short -event storming.pptx
Feedback on DDD Europe - short -event storming.pptx
 
From idea to implementation
From idea to implementationFrom idea to implementation
From idea to implementation
 
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)
 
New businessproposal ver5
New businessproposal ver5New businessproposal ver5
New businessproposal ver5
 
Custom Machine Learning Recipes for the Enterprise
Custom Machine Learning Recipes for the EnterpriseCustom Machine Learning Recipes for the Enterprise
Custom Machine Learning Recipes for the Enterprise
 
The Dual-Track Agile UX Process at Dell EMC
The Dual-Track Agile UX Process at Dell EMCThe Dual-Track Agile UX Process at Dell EMC
The Dual-Track Agile UX Process at Dell EMC
 
Ids johanes alexander
Ids   johanes alexanderIds   johanes alexander
Ids johanes alexander
 
Domain Driven Design for Mere Mortals
Domain Driven Design for Mere MortalsDomain Driven Design for Mere Mortals
Domain Driven Design for Mere Mortals
 
Mahesh_Sinha
Mahesh_SinhaMahesh_Sinha
Mahesh_Sinha
 
Sushma Singh-Resume
Sushma Singh-ResumeSushma Singh-Resume
Sushma Singh-Resume
 
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSIdiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRS
 

Más de Crishantha Nanayakkara

Más de Crishantha Nanayakkara (20)

Sri Lanka Government Enterprise Architecture
Sri Lanka Government Enterprise ArchitectureSri Lanka Government Enterprise Architecture
Sri Lanka Government Enterprise Architecture
 
Application Deployement Strategies
Application Deployement StrategiesApplication Deployement Strategies
Application Deployement Strategies
 
Azure for AWS Developers
Azure for AWS DevelopersAzure for AWS Developers
Azure for AWS Developers
 
Enterprise Integration in Cloud Native Microservices Architectures
Enterprise Integration in Cloud Native Microservices ArchitecturesEnterprise Integration in Cloud Native Microservices Architectures
Enterprise Integration in Cloud Native Microservices Architectures
 
AWS Systems Manager
AWS Systems ManagerAWS Systems Manager
AWS Systems Manager
 
AWS Big Data Landscape
AWS Big Data LandscapeAWS Big Data Landscape
AWS Big Data Landscape
 
1BT_Designing_Microservices
1BT_Designing_Microservices1BT_Designing_Microservices
1BT_Designing_Microservices
 
1BT_Tech_Talk_AWS_Cross_Account_Access
1BT_Tech_Talk_AWS_Cross_Account_Access1BT_Tech_Talk_AWS_Cross_Account_Access
1BT_Tech_Talk_AWS_Cross_Account_Access
 
AWS Security Hub
AWS Security HubAWS Security Hub
AWS Security Hub
 
Resiilient Architectures on AWS
Resiilient Architectures on AWSResiilient Architectures on AWS
Resiilient Architectures on AWS
 
Reactive Microservices
Reactive MicroservicesReactive Microservices
Reactive Microservices
 
Expectaions in IT industry
Expectaions in IT industryExpectaions in IT industry
Expectaions in IT industry
 
Towards Cloud Enabled Data Intensive Digital Transformation
Towards Cloud Enabled Data Intensive Digital TransformationTowards Cloud Enabled Data Intensive Digital Transformation
Towards Cloud Enabled Data Intensive Digital Transformation
 
Container Architecture
Container ArchitectureContainer Architecture
Container Architecture
 
Microservices
MicroservicesMicroservices
Microservices
 
Enterprise architecture in the current e-Government context in Sri Lanka
Enterprise architecture in the current e-Government context in Sri LankaEnterprise architecture in the current e-Government context in Sri Lanka
Enterprise architecture in the current e-Government context in Sri Lanka
 
Modern Trends in IT
Modern Trends in ITModern Trends in IT
Modern Trends in IT
 
ICTA Meetup 12 - Message Brokers
ICTA Meetup 12 - Message BrokersICTA Meetup 12 - Message Brokers
ICTA Meetup 12 - Message Brokers
 
ICTA Meetup 11 - Big Data
ICTA Meetup 11 - Big DataICTA Meetup 11 - Big Data
ICTA Meetup 11 - Big Data
 
Lanka Gate Core Components - Government CIO Workshop Dec 2013
Lanka Gate Core Components - Government CIO Workshop Dec 2013Lanka Gate Core Components - Government CIO Workshop Dec 2013
Lanka Gate Core Components - Government CIO Workshop Dec 2013
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 

Domain Driven Design and Hexagonal Architecture