SlideShare a Scribd company logo
Shaping Serverless
Architecture with
Domain-Driven Design
Patterns
Asher Sterkin
asher.sterkin@gmail.com
AWS Users Group IL Meetup
02/06/2018, Tlv Partners
About Myself
● Software technologist/architect
● Former VP Technology @ NDS and Distinguished Engineer @ Cisco
● Currently CTO @ IRKI
● C-level mentoring on software strategy
● Cross-discipline approach (connecting the dots):
○ (Strategic) Domain-Driven Design
○ Serverless Architecture
○ Cynefin
○ Wardley Maps
○ Lean Startup
○ Promise Theory
○ ...
What is Serverless Architecture?
● No server management (pure on-demand computing)
● Flexible scaling (automatic or throttled)
● Highly available (AWS services are always on)
● Two flavors:
○ AWS Lambda - no pay for idle (ideal for spiky, unpredictable workloads)
○ AWS Fargate - log running containers (for stable latency and/or full control over run-time)
○ Could be combined
● More details
● Serverless computing is a tectonic shift in software industry
○ S. Wardley “Why the fuss about serverless?”
Serverless 3-tier Web Application
Credit: Boaz Ziniman, “Serverless Use Cases with AWS Lambda”
Data Store in
Amazon
DynamoDB
Amazon S3
(static content)
Amazon
CloudFront
Amazon API
Gateway
AWS Lambda
(dynamic content)
How many Lambda Functions
and DynamoDB Tables are
required to implement this?
Why Bother?
Just throw in as many Lambdas as you wish
It Grows Rather Quickly
Yan Cui, “Yubl’s Road to Serverless Architecture”
Serverless
The danger is to come up with
Need Some Organizing Principles
Serverless Application Structure Factors
● Scalability
● Resource Utilization
● Access Control
● Productivity
● See also
Detour
Documenting AWS Serverless Architecture
AWS Icons are Hopelessly Inconsistent
When to use this?
And when this?
And when that?
What Does this Mean?
AWS Service?
SAM Template?
AWS Lambda Deployment?
Running Instance?
AWS Service?
SAM Template?
DynamoDB Schema?
DynamoDB Table Deployment?
DynamoDB Table Instance?
SDK Function Call?
Data Flow?
Address Reference?
Access Rights?
4+1 View of Software Architecture
Conceptual Physical
Process View Deployment View
Logical View
Use-Case View
Implementation View
End-user
Functionality
Programmers
Software management
Performance
Scalability
Throughput
System integrators
System topology
Delivery, installation
communication
System engineering
Analysts/Designers
Structure
...
...
P. Krutchen, “Architectural Blueprints - The “4+1” View Model of Software Architecture
Let’s Do It Again
mysite.com
api.mysite.com
mySiteData
/
mySiteRequestHandler
API resource running instance(s) table instance
invoke crud
bucket instance Evaluation?
address reference
API Gateway instance
address reference
Separate Application and Domain Services
mysite.com
api.mysite.com
DomainService_Data
/
mySiteWebFrontendService
smartPhone
mySiteSmartPhoneFrontendService
DomainService
DDD Focus is Here
crud
Ref: Netflix API
Server-side Rendering
Evaluation?
Domain-Driven Design at a Glance
Language
Model
Boundaries
Nesting
Today’s focus
An introductory presentation
could be found here. Look at the
end for recommended materials.
Introducing Bounded Context
● Maintaining “one-size fits all” domain model is seldom practical
● Any non-trivial software system usually needs multiple models
○ Highly cohesive inside (Bounded Context)
○ Loosely coupled outside (Context Map)
○ Good candidates for Microservices (E. Evans, “DDD and Microservices: At Last, Some
Boundaries!”)
Bounded Context A
Strong Semantic
Consistency Insides
Bounded Context B
Strong Semantic
Consistency Inside
Loose Coupling Outside
Context Map
Examples?
Bounded Context Services
DomainServiceA_DataDomainServiceA
DomainServiceB DomainServiceB_Data
crud
crud
Contains sensitive data!
Copy of publicly available data
Evaluation?
mySiteWebFrontendService
Bounded Context Services + Context Map
DomainServiceA_DataDomainServiceA
DomainServiceB DomainServiceB_Data
crud
crud
Evaluation?
mySiteWebFrontendService
DomainServiceB_DataStreams
DomainServiceB_EventHandler
trigger
put
Introducing Aggregate and Repository
Strong Transaction
Consistency + Invariant
<<Aggregate Root>>
Entity
Entity Value
Value
Eventual
Transaction
Consistency
aggregate storage
store/retrieve requests -->
command/query requests -->
update/query method call -->
● Data integrity boundaries
● Strong transactional consistency inside
● Eventual consistency outside
● Inner parts are accessible only via Aggregate Root
● Inside Aggregate some form of invariant is maintained
● Aggregates of the same type are stored within Repository
Command/query
Request Processor
Aggregate
Repository
Aggregate
Example?
Aggregate, Repository, Command/Query Handler
DomainServiceA_
AggregateX_Data
DomainServiceA
_AggregateX
DomainServiceA
_AggregateY DomainServiceA_
AggregateY_Data
crud
crud
Evaluation?
mySiteWebFrontendService
command/query requests
DomainServiceA
AggregateY_EventHandler
Introducing CQRS
● Stands for Command/Query Request Segregation
● Was first proposed by Greg Yung
● Based on Command-Query Separation advocated by Bertrand Meyer:
○ Each method should either return something and leave object state intact
○ Or change the object state and return nothing (declared void)
● Interesting Aggregates usually justify separate Command/Query interfaces
and data models
Query
Model
Aggregate A
State
Aggregate B
State
Command interface Query interface
Example?
CQRS
DomainServiceA_
AggregateX_StateData
DomainServiceA
_AggregateX_CommandHandler
DomainServiceA
_AggregateY_CommandHandler DomainServiceA_
AggregateY_StateData
get/put/delete
get/put/delete
Evaluation?
mySiteWebFrontendService
DomainServiceA_
View
DomainServiceA
_ViewBuilder
queries put/delete
get
get
commands
commands
Not Covered Here
● Separate Functions per Method/Event (easy, but needs justification)
● Event Sourcing (less easy, needs justification)
● Computation Services (not hard)
● Distributed Transactions (Saga)
● Fine-grained integration with API Gateway
● Integration with AppSync (GraphQL)
● Integration with IoT(Gateway)
● Integration with specialized AWS services (e.g. AWS Comprehend)
● Custom Machine Learning in Event/Command Handlers
● Integration with Blockchain
Interim Conclusions
● Serverless Architecture is a new beast to tame:
○ Gojko Adzic, “Designing for the Serverless Age”
● “4+1 View” approach helps with removing clutter from diagrams
○ Could used for Lightweight Architecture Decision Records
● Domain-Driven Design suggests a set of useful organizing principles
● Different options are valid under different circumstances
● It’s mostly about price/performance optimization
● Objective validation criteria:
○ Organizational structure (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”)
○ Consistency tolerance (E. Evans “Acknowledging CAP at the Root - in the Domain Model”)
○ Security guidelines
○ Scalability needs
○ SOLID architecture principles
“Consensus is poisonous
for innovation”
D. Snowden

More Related Content

What's hot (20)

PPSX
Microservices Architecture - Cloud Native Apps
Araf Karsh Hamid
 
PDF
Architect’s Open-Source Guide for a Data Mesh Architecture
Databricks
 
PDF
Cloud Native Application
VMUG IT
 
PPTX
Delta lake and the delta architecture
Adam Doyle
 
PDF
When NOT to use Apache Kafka?
Kai Wähner
 
PDF
Modernization patterns to refactor a legacy application into event driven mic...
Bilgin Ibryam
 
PDF
Azure Synapse Analytics
WinWire Technologies Inc
 
PDF
Introducing Databricks Delta
Databricks
 
PDF
Introduction to Azure Data Factory
Slava Kokaev
 
PDF
Introduction to Google Cloud Platform
Sujai Prakasam
 
PDF
Microservices for Application Modernisation
Ajay Kumar Uppal
 
PDF
Exploiting IAM in the google cloud platform - dani_goland_mohsan_farid
CloudVillage
 
PPSX
Domain Driven Design
Araf Karsh Hamid
 
PPTX
Practical FinOps in Practice
Petri Kallberg
 
PPTX
Micro services Architecture
Araf Karsh Hamid
 
PDF
Graph based real-time inventory and topology for network automation - webinar...
Neo4j
 
PPSX
On-premise to Microsoft Azure Cloud Migration.
Emtec Inc.
 
PPTX
Why to Cloud Native
Karthik Gaekwad
 
PDF
Google BigQuery Best Practices
Matillion
 
PDF
APIs in a Microservice Architecture
WSO2
 
Microservices Architecture - Cloud Native Apps
Araf Karsh Hamid
 
Architect’s Open-Source Guide for a Data Mesh Architecture
Databricks
 
Cloud Native Application
VMUG IT
 
Delta lake and the delta architecture
Adam Doyle
 
When NOT to use Apache Kafka?
Kai Wähner
 
Modernization patterns to refactor a legacy application into event driven mic...
Bilgin Ibryam
 
Azure Synapse Analytics
WinWire Technologies Inc
 
Introducing Databricks Delta
Databricks
 
Introduction to Azure Data Factory
Slava Kokaev
 
Introduction to Google Cloud Platform
Sujai Prakasam
 
Microservices for Application Modernisation
Ajay Kumar Uppal
 
Exploiting IAM in the google cloud platform - dani_goland_mohsan_farid
CloudVillage
 
Domain Driven Design
Araf Karsh Hamid
 
Practical FinOps in Practice
Petri Kallberg
 
Micro services Architecture
Araf Karsh Hamid
 
Graph based real-time inventory and topology for network automation - webinar...
Neo4j
 
On-premise to Microsoft Azure Cloud Migration.
Emtec Inc.
 
Why to Cloud Native
Karthik Gaekwad
 
Google BigQuery Best Practices
Matillion
 
APIs in a Microservice Architecture
WSO2
 

Similar to Shaping serverless architecture with domain driven design patterns (20)

PDF
Shaping serverless architecture with domain driven design patterns - py web-il
Asher Sterkin
 
PDF
Serverless ddd
Asher Sterkin
 
PPT
Technology Overview
Liran Zelkha
 
PDF
Container Days: Architecting Modern Apps on AWS
Tara Walker
 
PDF
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
Dhaval Nagar
 
PDF
Microservices and serverless for MegaStartups - DLD TLV 2017
Boaz Ziniman
 
PPTX
Effective Microservices In a Data-centric World
Randy Shoup
 
PPTX
Enterprise Serverless Adoption. An Experience Report
SheenBrisals
 
PPTX
Demistifying serverless on aws
AWS Riyadh User Group
 
PDF
Microservices: moving parts around
Chris Winters
 
PDF
Crio.do - Deployment on AWS Masterclass
Dhaval Nagar
 
PPTX
The Architectural Thinking Behind Full Stack Serverless
Yazid Hamdi
 
PPTX
IT Talk «Microservices & Serverless Architectures», Alexander Chichenin (Solu...
DataArt
 
PDF
20141210 - Microservice Container
Jamie (Taka) Wang
 
PDF
Software Architecture for Cloud Infrastructure
Tapio Rautonen
 
PPTX
Domain Driven Design & Hexagonal Architecture
Can Pekdemir
 
PDF
Stateful on Stateless - The Future of Applications in the Cloud
Markus Eisele
 
PDF
Microservices as an evolutionary architecture: lessons learned
Luram Archanjo
 
PDF
Software architecture, methodologies and design
Vedran Bilopavlović
 
PDF
Microservices for Architects - Atlanta 2018-03-28
Derek Ashmore
 
Shaping serverless architecture with domain driven design patterns - py web-il
Asher Sterkin
 
Serverless ddd
Asher Sterkin
 
Technology Overview
Liran Zelkha
 
Container Days: Architecting Modern Apps on AWS
Tara Walker
 
GreatLearning Webinar - Microservices and Event-Driven Architecture.pdf
Dhaval Nagar
 
Microservices and serverless for MegaStartups - DLD TLV 2017
Boaz Ziniman
 
Effective Microservices In a Data-centric World
Randy Shoup
 
Enterprise Serverless Adoption. An Experience Report
SheenBrisals
 
Demistifying serverless on aws
AWS Riyadh User Group
 
Microservices: moving parts around
Chris Winters
 
Crio.do - Deployment on AWS Masterclass
Dhaval Nagar
 
The Architectural Thinking Behind Full Stack Serverless
Yazid Hamdi
 
IT Talk «Microservices & Serverless Architectures», Alexander Chichenin (Solu...
DataArt
 
20141210 - Microservice Container
Jamie (Taka) Wang
 
Software Architecture for Cloud Infrastructure
Tapio Rautonen
 
Domain Driven Design & Hexagonal Architecture
Can Pekdemir
 
Stateful on Stateless - The Future of Applications in the Cloud
Markus Eisele
 
Microservices as an evolutionary architecture: lessons learned
Luram Archanjo
 
Software architecture, methodologies and design
Vedran Bilopavlović
 
Microservices for Architects - Atlanta 2018-03-28
Derek Ashmore
 
Ad

More from Asher Sterkin (18)

PDF
Dynamic Class Loader in TypeScript - Node.js-il Open Mic- Dec 23 2024.pdf
Asher Sterkin
 
PDF
Ports and Adapters in TypeScript - NodeJS TLV MeetpUp - Nov 7 2024.pdf
Asher Sterkin
 
PDF
Generic _Composite_ in Python_ PyWeb TLV Meetup 07.08.2024.pdf
Asher Sterkin
 
PDF
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Asher Sterkin
 
PDF
Essence of Requirements Engineering: Pragmatic Insights for 2024
Asher Sterkin
 
PDF
Cloud Infrastructure from Python Code: PyCon DE-23
Asher Sterkin
 
PDF
PyCascades-23.pdf
Asher Sterkin
 
PDF
PyConFR-23 Talk.pdf
Asher Sterkin
 
PDF
pyjamas22_ generic composite in python.pdf
Asher Sterkin
 
PDF
If your computer is cloud what its Operating System look like?
Asher Sterkin
 
PDF
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
Asher Sterkin
 
PDF
Documenting serverless architectures could we do it better - o'reily sa con...
Asher Sterkin
 
PDF
Developing cloud serverless components in Python: DDD Perspective
Asher Sterkin
 
PDF
Domain driven design: a gentle introduction
Asher Sterkin
 
PDF
Strategy toolbox for startsups
Asher Sterkin
 
PDF
AI as a service
Asher Sterkin
 
PDF
Software strategy for startups
Asher Sterkin
 
PDF
What is exactly anti fragile in dev ops - v3
Asher Sterkin
 
Dynamic Class Loader in TypeScript - Node.js-il Open Mic- Dec 23 2024.pdf
Asher Sterkin
 
Ports and Adapters in TypeScript - NodeJS TLV MeetpUp - Nov 7 2024.pdf
Asher Sterkin
 
Generic _Composite_ in Python_ PyWeb TLV Meetup 07.08.2024.pdf
Asher Sterkin
 
Ported to Cloud with Wing_ Blue ZnZone app from _Hexagonal Architecture Expla...
Asher Sterkin
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Asher Sterkin
 
Cloud Infrastructure from Python Code: PyCon DE-23
Asher Sterkin
 
PyCascades-23.pdf
Asher Sterkin
 
PyConFR-23 Talk.pdf
Asher Sterkin
 
pyjamas22_ generic composite in python.pdf
Asher Sterkin
 
If your computer is cloud what its Operating System look like?
Asher Sterkin
 
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
Asher Sterkin
 
Documenting serverless architectures could we do it better - o'reily sa con...
Asher Sterkin
 
Developing cloud serverless components in Python: DDD Perspective
Asher Sterkin
 
Domain driven design: a gentle introduction
Asher Sterkin
 
Strategy toolbox for startsups
Asher Sterkin
 
AI as a service
Asher Sterkin
 
Software strategy for startups
Asher Sterkin
 
What is exactly anti fragile in dev ops - v3
Asher Sterkin
 
Ad

Recently uploaded (20)

PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 

Shaping serverless architecture with domain driven design patterns

  • 1. Shaping Serverless Architecture with Domain-Driven Design Patterns Asher Sterkin [email protected] AWS Users Group IL Meetup 02/06/2018, Tlv Partners
  • 2. About Myself ● Software technologist/architect ● Former VP Technology @ NDS and Distinguished Engineer @ Cisco ● Currently CTO @ IRKI ● C-level mentoring on software strategy ● Cross-discipline approach (connecting the dots): ○ (Strategic) Domain-Driven Design ○ Serverless Architecture ○ Cynefin ○ Wardley Maps ○ Lean Startup ○ Promise Theory ○ ...
  • 3. What is Serverless Architecture? ● No server management (pure on-demand computing) ● Flexible scaling (automatic or throttled) ● Highly available (AWS services are always on) ● Two flavors: ○ AWS Lambda - no pay for idle (ideal for spiky, unpredictable workloads) ○ AWS Fargate - log running containers (for stable latency and/or full control over run-time) ○ Could be combined ● More details ● Serverless computing is a tectonic shift in software industry ○ S. Wardley “Why the fuss about serverless?”
  • 4. Serverless 3-tier Web Application Credit: Boaz Ziniman, “Serverless Use Cases with AWS Lambda” Data Store in Amazon DynamoDB Amazon S3 (static content) Amazon CloudFront Amazon API Gateway AWS Lambda (dynamic content) How many Lambda Functions and DynamoDB Tables are required to implement this?
  • 5. Why Bother? Just throw in as many Lambdas as you wish
  • 6. It Grows Rather Quickly Yan Cui, “Yubl’s Road to Serverless Architecture”
  • 7. Serverless The danger is to come up with
  • 8. Need Some Organizing Principles
  • 9. Serverless Application Structure Factors ● Scalability ● Resource Utilization ● Access Control ● Productivity ● See also
  • 11. AWS Icons are Hopelessly Inconsistent When to use this? And when this? And when that?
  • 12. What Does this Mean? AWS Service? SAM Template? AWS Lambda Deployment? Running Instance? AWS Service? SAM Template? DynamoDB Schema? DynamoDB Table Deployment? DynamoDB Table Instance? SDK Function Call? Data Flow? Address Reference? Access Rights?
  • 13. 4+1 View of Software Architecture Conceptual Physical Process View Deployment View Logical View Use-Case View Implementation View End-user Functionality Programmers Software management Performance Scalability Throughput System integrators System topology Delivery, installation communication System engineering Analysts/Designers Structure ... ... P. Krutchen, “Architectural Blueprints - The “4+1” View Model of Software Architecture
  • 14. Let’s Do It Again mysite.com api.mysite.com mySiteData / mySiteRequestHandler API resource running instance(s) table instance invoke crud bucket instance Evaluation? address reference API Gateway instance address reference
  • 15. Separate Application and Domain Services mysite.com api.mysite.com DomainService_Data / mySiteWebFrontendService smartPhone mySiteSmartPhoneFrontendService DomainService DDD Focus is Here crud Ref: Netflix API Server-side Rendering Evaluation?
  • 16. Domain-Driven Design at a Glance Language Model Boundaries Nesting Today’s focus An introductory presentation could be found here. Look at the end for recommended materials.
  • 17. Introducing Bounded Context ● Maintaining “one-size fits all” domain model is seldom practical ● Any non-trivial software system usually needs multiple models ○ Highly cohesive inside (Bounded Context) ○ Loosely coupled outside (Context Map) ○ Good candidates for Microservices (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”) Bounded Context A Strong Semantic Consistency Insides Bounded Context B Strong Semantic Consistency Inside Loose Coupling Outside Context Map Examples?
  • 18. Bounded Context Services DomainServiceA_DataDomainServiceA DomainServiceB DomainServiceB_Data crud crud Contains sensitive data! Copy of publicly available data Evaluation? mySiteWebFrontendService
  • 19. Bounded Context Services + Context Map DomainServiceA_DataDomainServiceA DomainServiceB DomainServiceB_Data crud crud Evaluation? mySiteWebFrontendService DomainServiceB_DataStreams DomainServiceB_EventHandler trigger put
  • 20. Introducing Aggregate and Repository Strong Transaction Consistency + Invariant <<Aggregate Root>> Entity Entity Value Value Eventual Transaction Consistency aggregate storage store/retrieve requests --> command/query requests --> update/query method call --> ● Data integrity boundaries ● Strong transactional consistency inside ● Eventual consistency outside ● Inner parts are accessible only via Aggregate Root ● Inside Aggregate some form of invariant is maintained ● Aggregates of the same type are stored within Repository Command/query Request Processor Aggregate Repository Aggregate Example?
  • 21. Aggregate, Repository, Command/Query Handler DomainServiceA_ AggregateX_Data DomainServiceA _AggregateX DomainServiceA _AggregateY DomainServiceA_ AggregateY_Data crud crud Evaluation? mySiteWebFrontendService command/query requests DomainServiceA AggregateY_EventHandler
  • 22. Introducing CQRS ● Stands for Command/Query Request Segregation ● Was first proposed by Greg Yung ● Based on Command-Query Separation advocated by Bertrand Meyer: ○ Each method should either return something and leave object state intact ○ Or change the object state and return nothing (declared void) ● Interesting Aggregates usually justify separate Command/Query interfaces and data models Query Model Aggregate A State Aggregate B State Command interface Query interface Example?
  • 24. Not Covered Here ● Separate Functions per Method/Event (easy, but needs justification) ● Event Sourcing (less easy, needs justification) ● Computation Services (not hard) ● Distributed Transactions (Saga) ● Fine-grained integration with API Gateway ● Integration with AppSync (GraphQL) ● Integration with IoT(Gateway) ● Integration with specialized AWS services (e.g. AWS Comprehend) ● Custom Machine Learning in Event/Command Handlers ● Integration with Blockchain
  • 25. Interim Conclusions ● Serverless Architecture is a new beast to tame: ○ Gojko Adzic, “Designing for the Serverless Age” ● “4+1 View” approach helps with removing clutter from diagrams ○ Could used for Lightweight Architecture Decision Records ● Domain-Driven Design suggests a set of useful organizing principles ● Different options are valid under different circumstances ● It’s mostly about price/performance optimization ● Objective validation criteria: ○ Organizational structure (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”) ○ Consistency tolerance (E. Evans “Acknowledging CAP at the Root - in the Domain Model”) ○ Security guidelines ○ Scalability needs ○ SOLID architecture principles
  • 26. “Consensus is poisonous for innovation” D. Snowden