SlideShare a Scribd company logo
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

PPTX
Introduction to BreezeJs
PPTX
ADF Bindings & Data Controls
PPTX
ATG Framework,Formhandlers,Pricing
PPTX
Building High Quality Solutions with Design Patterns & Application Foundation...
PDF
Microsoft Portals Deep Dive - Andrew Ly & Lachlan Wright
PDF
Volt Showcase - Planning Poker
PPTX
ATG Architecture
PPTX
Introduction to SalesForce
Introduction to BreezeJs
ADF Bindings & Data Controls
ATG Framework,Formhandlers,Pricing
Building High Quality Solutions with Design Patterns & Application Foundation...
Microsoft Portals Deep Dive - Andrew Ly & Lachlan Wright
Volt Showcase - Planning Poker
ATG Architecture
Introduction to SalesForce

What's hot (20)

PDF
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
PPTX
Js il 2013 breeze.js
PPT
oracle adf training | oracle adf course | oracle adf certification training
ODP
Modelibra Software Family
PPTX
Uni Paa S Overview
PPTX
Ax 2012 enterprise portal development
PPTX
Domain driven design
PPTX
Oracle fusion dba online training
PPT
A Zend Architecture presentation
PPTX
Overview of atg framework
PPSX
Oracle ADF Overview for Beginners
PPTX
Distributed Parcel Tracking/Management System Overview
PPT
Developing for Astoria: ADO.NET Data Services
PPTX
Session 35 - Design Patterns
DOCX
Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...
PDF
Oracle fusion adf_online_training_in_africa
PPTX
Oracle ِApplication Development Framework (ADF)
PPTX
Oracle ADF Training| Oracle ADF Developer Training
DOC
Best Oracle adf online training
SPCA2013 - SharePoint Nightmares - Coding Patterns and Practices
Js il 2013 breeze.js
oracle adf training | oracle adf course | oracle adf certification training
Modelibra Software Family
Uni Paa S Overview
Ax 2012 enterprise portal development
Domain driven design
Oracle fusion dba online training
A Zend Architecture presentation
Overview of atg framework
Oracle ADF Overview for Beginners
Distributed Parcel Tracking/Management System Overview
Developing for Astoria: ADO.NET Data Services
Session 35 - Design Patterns
Oracle ADF Online Training By Seasoft IT Solutions | Orace ADF Course Content...
Oracle fusion adf_online_training_in_africa
Oracle ِApplication Development Framework (ADF)
Oracle ADF Training| Oracle ADF Developer Training
Best Oracle adf online training
Ad

Similar to domain driven design talk (20)

PPT
Ado.Net Data Services (Astoria)
PPT
ADO.NET Data Services
PPTX
Develop iOS and Android apps with SharePoint/Office 365
PDF
JavaOne 2014 - Supporting Multi-tenancy Applications with Java EE
PDF
AWS Innovate: Build a Data Lake on AWS- Johnathon Meichtry
PPT
Windows Azure and a little SQL Data Services
PPTX
Building RESTfull Data Services with WebAPI
PPTX
Mike Taulty OData (NxtGen User Group UK)
PPTX
PPTX
Rest with Java EE 6 , Security , Backbone.js
PDF
SharePoint Saturday The Conference DC - How the client object model saved the...
PPT
Building Cloud-Native Applications with Microsoft Windows Azure
PPTX
RIA services exposing & consuming queries
PDF
Medium TechTalk — iOS
PPTX
Developing Next-Gen Enterprise Web Application
PDF
Hilfe, wir brauchen ein Frontend
PPT
PPTX
The web as it should be
PPTX
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
ODP
Order Management Plus Integration Topics
Ado.Net Data Services (Astoria)
ADO.NET Data Services
Develop iOS and Android apps with SharePoint/Office 365
JavaOne 2014 - Supporting Multi-tenancy Applications with Java EE
AWS Innovate: Build a Data Lake on AWS- Johnathon Meichtry
Windows Azure and a little SQL Data Services
Building RESTfull Data Services with WebAPI
Mike Taulty OData (NxtGen User Group UK)
Rest with Java EE 6 , Security , Backbone.js
SharePoint Saturday The Conference DC - How the client object model saved the...
Building Cloud-Native Applications with Microsoft Windows Azure
RIA services exposing & consuming queries
Medium TechTalk — iOS
Developing Next-Gen Enterprise Web Application
Hilfe, wir brauchen ein Frontend
The web as it should be
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Order Management Plus Integration Topics
Ad

Recently uploaded (20)

PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
System and Network Administraation Chapter 3
PPTX
assetexplorer- product-overview - presentation
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
PTS Company Brochure 2025 (1).pdf.......
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context
Introduction Database Management System for Course Database
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
System and Network Administraation Chapter 3
assetexplorer- product-overview - presentation
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
VVF-Customer-Presentation2025-Ver1.9.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Understanding Forklifts - TECH EHS Solution
Wondershare Filmora 15 Crack With Activation Key [2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Operating system designcfffgfgggggggvggggggggg

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