SlideShare a Scribd company logo
1 of 12
Presentation
REST
Application (thin and no biz logic!)
Server API Client
Domain (core, biz logic)
Factory Repository Entity/VO Aggregate
Infrastructure
Persistence Push, Mail … Report, Print…
CLI HTML
Entity
• An object is distinguished by its identity.
• Aggregate root must be an entity.
• Eg: PhoneItem, User, Order, LineItem
Value Object
• No identity.
• Only care about attributes
• Immutable.
• Eg: UserProfile, OrderAddress
Aggregate
RootA
EntityA EntityB
ValueObject
RootB
Repository
Factory
Aggregate
Get Order By Id
Caching
• Presentation Layer
Reduce data format conversion time
• Service (App Layer/Domain Layer)
Reduce multiple infrastructure layer cache hits
• Infrastructure
Reduce hits on actual persistence service (eg: MySQL)
Cache-Presentation
GET /orders/{orderId}
order_json = cache.get(“/order/#{orderId}”)
if order_json?
order_response = app.get_order_by_id(orderId)
cache.set(“/order/#{orderId}”, convert_to_json(order_response))
{
“userId”: “123abc”,
“id”: “order001”,
“lineItems”: […], #two line items
“address”: {…}
}
POST /orders/{orderId}/lineitems/ #add a new item to the order
{
“id”: “order001”,
“phoneItemIds”: [“e5ab0134b”]
}
order = app.add_line_items(“order001”, “e5ab0134b”)
cache.set(“/order/#{orderId}”, to_json(order))
Cache-Service
app.get_order_by_id(id)
order_response = cache.get(“get_order_by_id_#{id}”)
if order_response.nil?
order = order_repository.find_by_id(id)
#convert order to order_response
cache.set(“get_order_by_id_#{id}”, order_response)
return order_response
app.app.add_line_items(order_id, phone_item_id)
order = order_repository.find_by_id(id)
phone_item = phone_item_repository.find_by_id(phone_item_id)
order_item = order.add_line_item(phone_item)
order = order_repository.store(order)
#convert order to order_response
cache.set(“get_order_by_id_#{id}”, order_response)
return order_response
Cache-Infrastructure
order_access.select_by_id(id)
data = cache.get(“select_order_data_by_id_#{id}”)
if data.nil?
#retrieve from persistence media (eg: mysql)
cache.set(“select_order_data_by_id_#{id}”, data)
lineitem_access.select_by_order_id(id)
data = cache.get(“select_lineitem_data_by_order_id_#{id}”)
if data.nil?
#retrieve from persistence media (eg: mysql)
cache.set(“select_lineitem_data_by_order_id_#{id}”, data)
lineitem_access.insert(line_item_data)
#insert line_item_data into persistence media (eg: mysql)
cache.clean(“select_lineitem_data_by_order_id_#{line_item_data.order_id}”)
Model vs Module
• Domain model is inventory.
• Ordering is sub domain model
• User, PhoneItem and Order are modules in ordering
domain model.
File Structure
lib/
inventory_app.rb
order_response.rb
lineitem_response.rb
inventory_app_server.rb
…
domain/ <——— domain layer
phone_item/
phone_item.rb
phone_item_factory.rb
phone_item_repository.rb
order/
order.rb
lineitem.rb
order_factory.rb
order_repository.rb
services/
<services>.rb
base/ <——— infrastructure layer
order_access.rb
lineitem_access.rb
order_data
lineitem_data.rb
…
some_service_interface.rb
persist/
mysql/
<access implementation>.rb
some_service_interface/
views/ <——— presentation layer

More Related Content

What's hot

oracle adf training | oracle adf course | oracle adf certification training
oracle adf training | oracle adf course | oracle adf certification training oracle adf training | oracle adf course | oracle adf certification training
oracle adf training | oracle adf course | oracle adf certification training
Nancy Thomas
 
Uni Paa S Overview
Uni Paa S  OverviewUni Paa S  Overview
Uni Paa S Overview
Arik
 
A Zend Architecture presentation
A Zend Architecture presentationA Zend Architecture presentation
A Zend Architecture presentation
techweb08
 
Developing for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data ServicesDeveloping for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data Services
Harish Ranganathan
 
Oracle fusion adf_online_training_in_africa
Oracle fusion adf_online_training_in_africaOracle fusion adf_online_training_in_africa
Oracle fusion adf_online_training_in_africa
magnificsmile
 
Oracle ِApplication Development Framework (ADF)
Oracle ِApplication Development Framework (ADF)Oracle ِApplication Development Framework (ADF)
Oracle ِApplication Development Framework (ADF)
ِAbdulla AlShourbagy
 

What's hot (20)

SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and PracticesSPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
 
Js il 2013 breeze.js
Js il 2013 breeze.jsJs il 2013 breeze.js
Js il 2013 breeze.js
 
oracle adf training | oracle adf course | oracle adf certification training
oracle adf training | oracle adf course | oracle adf certification training oracle adf training | oracle adf course | oracle adf certification training
oracle adf training | oracle adf course | oracle adf certification training
 
Couch db
Couch dbCouch db
Couch db
 
Modelibra Software Family
Modelibra Software FamilyModelibra Software Family
Modelibra Software Family
 
Uni Paa S Overview
Uni Paa S  OverviewUni Paa S  Overview
Uni Paa S Overview
 
Ax 2012 enterprise portal development
Ax 2012 enterprise portal developmentAx 2012 enterprise portal development
Ax 2012 enterprise portal development
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Oracle fusion dba online training
Oracle fusion  dba online trainingOracle fusion  dba online training
Oracle fusion dba online training
 
A Zend Architecture presentation
A Zend Architecture presentationA Zend Architecture presentation
A Zend Architecture presentation
 
Overview of atg framework
Overview of atg frameworkOverview of atg framework
Overview of atg framework
 
Oracle ADF Overview for Beginners
Oracle ADF Overview for BeginnersOracle ADF Overview for Beginners
Oracle ADF Overview for Beginners
 
Distributed Parcel Tracking/Management System Overview
Distributed Parcel Tracking/Management System OverviewDistributed Parcel Tracking/Management System Overview
Distributed Parcel Tracking/Management System Overview
 
Developing for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data ServicesDeveloping for Astoria: ADO.NET Data Services
Developing for Astoria: ADO.NET Data Services
 
Session 35 - Design Patterns
Session 35 - Design PatternsSession 35 - Design Patterns
Session 35 - Design Patterns
 
Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...
Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...
Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...
 
Oracle fusion adf_online_training_in_africa
Oracle fusion adf_online_training_in_africaOracle fusion adf_online_training_in_africa
Oracle fusion adf_online_training_in_africa
 
Oracle ِApplication Development Framework (ADF)
Oracle ِApplication Development Framework (ADF)Oracle ِApplication Development Framework (ADF)
Oracle ِApplication Development Framework (ADF)
 
Oracle ADF Training| Oracle ADF Developer Training
Oracle ADF Training| Oracle ADF Developer TrainingOracle ADF Training| Oracle ADF Developer Training
Oracle ADF Training| Oracle ADF Developer Training
 
Best Oracle adf online training
Best Oracle adf online trainingBest Oracle adf online training
Best Oracle adf online training
 

Similar to domain driven design talk

Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)
Igor Moochnick
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
Carol McDonald
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
Liam Cleary [MVP]
 

Similar to domain driven design talk (20)

Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)Ado.Net Data Services (Astoria)
Ado.Net Data Services (Astoria)
 
ADO.NET Data Services
ADO.NET Data ServicesADO.NET Data Services
ADO.NET Data Services
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
 
JavaOne 2014 - Supporting Multi-tenancy Applications with Java EE
JavaOne 2014 - Supporting Multi-tenancy Applications with Java EEJavaOne 2014 - Supporting Multi-tenancy Applications with Java EE
JavaOne 2014 - Supporting Multi-tenancy Applications with Java EE
 
AWS Innovate: Build a Data Lake on AWS- Johnathon Meichtry
AWS Innovate: Build a Data Lake on AWS- Johnathon MeichtryAWS Innovate: Build a Data Lake on AWS- Johnathon Meichtry
AWS Innovate: Build a Data Lake on AWS- Johnathon Meichtry
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Services
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Rest
RestRest
Rest
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
 
Building Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows AzureBuilding Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows Azure
 
RIA services exposing & consuming queries
RIA services exposing & consuming queriesRIA services exposing & consuming queries
RIA services exposing & consuming queries
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
Supercharge Your Product Development with Continuous Delivery & Serverless Co...
Supercharge Your Product Development with Continuous Delivery & Serverless Co...Supercharge Your Product Development with Continuous Delivery & Serverless Co...
Supercharge Your Product Development with Continuous Delivery & Serverless Co...
 
Hilfe, wir brauchen ein Frontend
Hilfe, wir brauchen ein FrontendHilfe, wir brauchen ein Frontend
Hilfe, wir brauchen ein Frontend
 
Obiee
ObieeObiee
Obiee
 
The web as it should be
The web as it should beThe web as it should be
The web as it should be
 
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developersChris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

domain driven design talk

  • 1. Presentation REST Application (thin and no biz logic!) Server API Client Domain (core, biz logic) Factory Repository Entity/VO Aggregate Infrastructure Persistence Push, Mail … Report, Print… CLI HTML
  • 2. Entity • An object is distinguished by its identity. • Aggregate root must be an entity. • Eg: PhoneItem, User, Order, LineItem
  • 3. Value Object • No identity. • Only care about attributes • Immutable. • Eg: UserProfile, OrderAddress
  • 7. Caching • Presentation Layer Reduce data format conversion time • Service (App Layer/Domain Layer) Reduce multiple infrastructure layer cache hits • Infrastructure Reduce hits on actual persistence service (eg: MySQL)
  • 8. Cache-Presentation GET /orders/{orderId} order_json = cache.get(“/order/#{orderId}”) if order_json? order_response = app.get_order_by_id(orderId) cache.set(“/order/#{orderId}”, convert_to_json(order_response)) { “userId”: “123abc”, “id”: “order001”, “lineItems”: […], #two line items “address”: {…} } POST /orders/{orderId}/lineitems/ #add a new item to the order { “id”: “order001”, “phoneItemIds”: [“e5ab0134b”] } order = app.add_line_items(“order001”, “e5ab0134b”) cache.set(“/order/#{orderId}”, to_json(order))
  • 9. Cache-Service app.get_order_by_id(id) order_response = cache.get(“get_order_by_id_#{id}”) if order_response.nil? order = order_repository.find_by_id(id) #convert order to order_response cache.set(“get_order_by_id_#{id}”, order_response) return order_response app.app.add_line_items(order_id, phone_item_id) order = order_repository.find_by_id(id) phone_item = phone_item_repository.find_by_id(phone_item_id) order_item = order.add_line_item(phone_item) order = order_repository.store(order) #convert order to order_response cache.set(“get_order_by_id_#{id}”, order_response) return order_response
  • 10. Cache-Infrastructure order_access.select_by_id(id) data = cache.get(“select_order_data_by_id_#{id}”) if data.nil? #retrieve from persistence media (eg: mysql) cache.set(“select_order_data_by_id_#{id}”, data) lineitem_access.select_by_order_id(id) data = cache.get(“select_lineitem_data_by_order_id_#{id}”) if data.nil? #retrieve from persistence media (eg: mysql) cache.set(“select_lineitem_data_by_order_id_#{id}”, data) lineitem_access.insert(line_item_data) #insert line_item_data into persistence media (eg: mysql) cache.clean(“select_lineitem_data_by_order_id_#{line_item_data.order_id}”)
  • 11. Model vs Module • Domain model is inventory. • Ordering is sub domain model • User, PhoneItem and Order are modules in ordering domain model.
  • 12. File Structure lib/ inventory_app.rb order_response.rb lineitem_response.rb inventory_app_server.rb … domain/ <——— domain layer phone_item/ phone_item.rb phone_item_factory.rb phone_item_repository.rb order/ order.rb lineitem.rb order_factory.rb order_repository.rb services/ <services>.rb base/ <——— infrastructure layer order_access.rb lineitem_access.rb order_data lineitem_data.rb … some_service_interface.rb persist/ mysql/ <access implementation>.rb some_service_interface/ views/ <——— presentation layer