SlideShare a Scribd company logo
four architectural patterns
“ W H Y, S O M E T I M E S I ’ V E R E V I E W E D A S M A N Y A S
B E F O R E B R E A K FA S T ”
Slides Available: http://tinyurl.com/ArchiAlice
W H AT I S A N
“ A R C H I T E C T U R A L
PAT T E R N ”
• Enough ideas, rules and best
practices that stick together and form
a consistent approach to
development of systems.
• There is no one best or correct
pattern. It depends on your use case.
Some named ones may even be out
of favour.
“And what is the use of a book,” thought Alice, “without pictures or conversations?” 
domain driven design
W H AT I S D O M A I N
D R I V E N D E S I G N ?
• Your system is formed organically
through consideration of the real-
world domain it exists in.
• Since all 300 of us do not want to do
this together, we can identify
subdomains and/or bounded contexts.
• This is discovered through
collaboration with domain experts and
the adoption of a “ubiquitous
language”
W H AT I S D O M A I N
D R I V E N D E S I G N ?
• It believes strongly in the layered architecture,
and defines what it thinks can exist in the
“domain” layer:
• Entity (things with state)
• Value Object (Immutable attributes)
• Aggregate (Cluster of objects treated as one
for data changes)
• Event (“something has happened”)
• Service, Repository, Factory (for managing
changing, retrieval or creation of any of the
above)
W H Y ?
• Reduces cost of communication
across different parts of the
organisation
• Minimises risk of significant
refactoring
“She generally gave herself very good advice, (though she very seldom followed it).”
command-query segregation
W H AT I S C Q S ?
• You should have some interfaces to
your system that mutate logic; and
some that read state.
• They should not mix.
W H Y ?
• Clean code
• Reusable code
• Self-documentation / Principle of
least surprise
“But it’s no use now,” thought poor Alice, “to pretend to be two people!
Why, there’s hardly enough of me left to make one respectable person!” 
command-query
responsibility segregation
W H AT I S C Q R S ?
• You should have separate systems in
place for creating and reading data.
• This is more often used to describe
interfaces at a system or domain level
W H AT I S C Q R S ?
W R I T E R E A D
R E A D
W H Y ?
• (This is the most controversial of the
patterns presented today)
• Encourage re-use of APIs and
services
• Clear single source of truth for data
• Read and write can be scaled
independently
“I could tell you my adventures—beginning from this morning,” said Alice a little timidly
“but it’s no use going back to yesterday, because I was a different person then.”
event sourcing
W H AT I S E V E N T
S O U R C I N G ?
• The source of truth for your domain
is a series of events that tells the
system what state has changed.
• Any higher fidelity views are
“materialised” from this event stream
and are second class data citizen
W H Y ?
• Data restoration for free (if you treat
your events right)
• Audit log for free
• Can understand the state of a system
at a given time
“It seems very pretty,” she said when she had
finished it, “but it’s rather hard to understand!”
( Y O U S E E S H E D I D N ’ T L I K E T O C O N F E S S ,
E V E N T O H E R S E L F, T H AT S H E C O U L D N ’ T
M A K E I T O U T AT A L L . )
W H AT Y O U N E E D T O M O D E L …
D O M A I N
E V E N T S
C O M M A N D
E V E N T
• Requests by a user/system/etc. to change something
• Often written in the imperative mood
• Meaningful domain events - not just CRUD operations
• “Cancel Direct Debit”, “Onboard Customer”,
“Submit Meter Read”
• A notification that the state of the system has
explicitly changed (or that is hasn’t)
• Often written as participles
• Meaningful domain events - not just CRUD operations
• “Direct Debit Cancelled”, “Customer was not
onboarded”
W H AT Y O U N E E D T O M O D E L …
A G G R E G AT E S
C O M M A N D
E V E N T
• The aggregate contains the business logic to validate
a command, and understand the impact it should
have on the system.
• If you remember from DDD: Aggregate is a domain
entity. Domain entities should have the knowledge
internally to determine whether a command is
successful. (Clean Code, SOLID, Feature Envy etc.)
• The aggregate will be a noun, and could be
“Customer” or “CustomerAggregate”
• May be split up for ease, in which case the top-level
aggregate is an “aggregate root”.
E V E N T
E V E N T
W H AT Y O U N E E D T O M O D E L …
S A G A
E V E N T
E V E N T
• A saga is a state machine that manages processes
that span multiple services. These should still be
domain processes!
• The state of the saga is driven by the events that other
services generate. If the saga feels that a change is
needed based on the events, it can implement those
changes by issuing one or more commands.
• A saga should named after a business process, such
as “Account Creation” or “Account Creation Saga”
E V E N T
C O M M A N D
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
M AT E R I A L I S E R
C O M M A N D
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
C O M M A N D
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
M AT E R I A L I S E R
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
E V E N T
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
M AT E R I A L I S E R
E V E N T
E V E N T
M AT E R I A L I S E R
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
E V E N T
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
E V E N T
E V E N T
N E W R E C O R D
M AT E R I A L I S E R
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
N E W R E C O R D
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
E V E N T
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E D
V I E W
M AT E R I A L I S E R
E V E N T
E V E N T
Z O O M I N G O U T…
A G G R E G AT E
W R I T E A P I
R E A D A P I
S A G A
E V E N T
S T O R E
M AT E R I A L I S E R
M AT E R I A L I S E D
V I E W
C O M M A N D
W H Y ?
• All the benefits of the other patterns
we’ve discussed
• Single, consolidated architecture that
scales nicely with the number of
teams
• Can spin up new microservices with
minimal cost down the line
“So she was considering in her own mind whether
the pleasure of making
a daisy-chain would
be worth the trouble
of getting up & picking the daisies...”
M I N I S T RY O F
J U S T I C E
• https://github.com/
CJSCommonPlatform/
microservice_framework_version_6
• Did the project succeed? Not really.
(And the consultancy behind was trashed in the news.)
• Did the architecture work? No.
Developers not good enough to
understand it, Ivory Tower Architecture
Function, 8 weeks to get words on a
screen.
M E T T L E
• Challenger bank targeting SMEs.
• Did the project succeed? Still going
strong. (And the consultancy behind was trashed
in the news.)
• Did it work? Kind of? After a bit of
wrangling. But we didn’t get half of
what it promised.
P E R S O N A L
P R O J E C T
• https://github.com/
SwamWithTurtles/decrypto-be/
• Did it work? Yeah, kinda but one
person projects are always doomed
to succeed.
Everything’s got a moral
(if only you can find it)

More Related Content

PDF
KT isn't just telling people stuff: how to plan and do effective knowledge tr...
PDF
The Future of WordPress (and Your Role In It)
PDF
Business Agility and Simplicity, the art of the possible!
PPTX
SharePoint Saturday Redmond - Building solutions with the future in mind
PPTX
Yammer time
PDF
XD Immersive: Jessica Outlaw, Augmented Reality and the Future of Immersive E...
PDF
XD Immersive: Jessica Outlaw, Virtual Reality and the Future of Immersive Exp...
PDF
#Winning at Instagram, or How to Learn to Stop Worrying and Love the Algorithm
KT isn't just telling people stuff: how to plan and do effective knowledge tr...
The Future of WordPress (and Your Role In It)
Business Agility and Simplicity, the art of the possible!
SharePoint Saturday Redmond - Building solutions with the future in mind
Yammer time
XD Immersive: Jessica Outlaw, Augmented Reality and the Future of Immersive E...
XD Immersive: Jessica Outlaw, Virtual Reality and the Future of Immersive Exp...
#Winning at Instagram, or How to Learn to Stop Worrying and Love the Algorithm

What's hot (11)

PDF
Who is Doing the Work? Designing for AI across modes of interaction.
PDF
XD Immersive: Andrew McHugh, "Making the Transition to VR / AR Experience Des...
PPTX
Swarming 2015 copy powerpoint
PDF
The Ethics of Everybody Else
PDF
Getting Things Done met David Allen - Masterclass met ScaleUp Company 22 apri...
PPTX
Architecting your IT career
PDF
TDD Using the SOLID Principles
PDF
Part 2: Leadership & Innovation Tactics
PPTX
Agile metrics
PPTX
Lean startup - ProductTank Talk
PDF
Understanding Invisible Labour
Who is Doing the Work? Designing for AI across modes of interaction.
XD Immersive: Andrew McHugh, "Making the Transition to VR / AR Experience Des...
Swarming 2015 copy powerpoint
The Ethics of Everybody Else
Getting Things Done met David Allen - Masterclass met ScaleUp Company 22 apri...
Architecting your IT career
TDD Using the SOLID Principles
Part 2: Leadership & Innovation Tactics
Agile metrics
Lean startup - ProductTank Talk
Understanding Invisible Labour
Ad

Similar to Four Architectural Patterns (20)

PDF
Data Modelling at Scale
PDF
From Content Strategy to Drupal Site Building - Connecting the Dots
PDF
From Content Strategy to Drupal Site Building - Connecting the dots
PPTX
Digital Data Commons - Emergence of AI Blockchain Convergence
PDF
Choosing the right database
PPTX
Content First in Action
PDF
Switching horses midstream - From Waterfall to Agile
PDF
Development and Deployment: The Human Factor
PDF
Decoupled APIs through Microservices
PDF
Domínio: Dividir e conquistar
PDF
PHP Experience 2016 - ROA – Resource Oriented Architecture
PPTX
Scaling your Tableau - Migrating from Tableau Online to a proper DWH solution...
PDF
From the right process to a solid cultural change
PDF
Choosing the Right Database
PDF
Bristol Uni - Use Cases of NoSQL
PDF
The Expanding Boundaries of CSS
PDF
100% Visibility - Jason Yee - Codemotion Amsterdam 2018
PDF
Small data big impact
PDF
Thinking like a Network
PDF
Technologies That Will Change Everything
Data Modelling at Scale
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the dots
Digital Data Commons - Emergence of AI Blockchain Convergence
Choosing the right database
Content First in Action
Switching horses midstream - From Waterfall to Agile
Development and Deployment: The Human Factor
Decoupled APIs through Microservices
Domínio: Dividir e conquistar
PHP Experience 2016 - ROA – Resource Oriented Architecture
Scaling your Tableau - Migrating from Tableau Online to a proper DWH solution...
From the right process to a solid cultural change
Choosing the Right Database
Bristol Uni - Use Cases of NoSQL
The Expanding Boundaries of CSS
100% Visibility - Jason Yee - Codemotion Amsterdam 2018
Small data big impact
Thinking like a Network
Technologies That Will Change Everything
Ad

More from David Simons (12)

PDF
Statistical Programming with JavaScript
PDF
Non-Functional Requirements
PDF
High quality Front-End
PPTX
Build Tools & Maven
PDF
Graph Modelling
PDF
Graph theory in Practise
PDF
Decoupled APIs through microservices
PDF
TDD: What is it good for?
PDF
Domain Driven Design: A Precis
PDF
10 d bs in 30 minutes
PPTX
Using Clojure to Marry Neo4j and Open Democracy
PDF
Exploring Election Results with Neo4J
Statistical Programming with JavaScript
Non-Functional Requirements
High quality Front-End
Build Tools & Maven
Graph Modelling
Graph theory in Practise
Decoupled APIs through microservices
TDD: What is it good for?
Domain Driven Design: A Precis
10 d bs in 30 minutes
Using Clojure to Marry Neo4j and Open Democracy
Exploring Election Results with Neo4J

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Cloud computing and distributed systems.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
Teaching material agriculture food technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I

Four Architectural Patterns

  • 1. four architectural patterns “ W H Y, S O M E T I M E S I ’ V E R E V I E W E D A S M A N Y A S B E F O R E B R E A K FA S T ”
  • 3. W H AT I S A N “ A R C H I T E C T U R A L PAT T E R N ” • Enough ideas, rules and best practices that stick together and form a consistent approach to development of systems. • There is no one best or correct pattern. It depends on your use case. Some named ones may even be out of favour.
  • 4. “And what is the use of a book,” thought Alice, “without pictures or conversations?”  domain driven design
  • 5. W H AT I S D O M A I N D R I V E N D E S I G N ? • Your system is formed organically through consideration of the real- world domain it exists in. • Since all 300 of us do not want to do this together, we can identify subdomains and/or bounded contexts. • This is discovered through collaboration with domain experts and the adoption of a “ubiquitous language”
  • 6. W H AT I S D O M A I N D R I V E N D E S I G N ? • It believes strongly in the layered architecture, and defines what it thinks can exist in the “domain” layer: • Entity (things with state) • Value Object (Immutable attributes) • Aggregate (Cluster of objects treated as one for data changes) • Event (“something has happened”) • Service, Repository, Factory (for managing changing, retrieval or creation of any of the above)
  • 7. W H Y ? • Reduces cost of communication across different parts of the organisation • Minimises risk of significant refactoring
  • 8. “She generally gave herself very good advice, (though she very seldom followed it).” command-query segregation
  • 9. W H AT I S C Q S ? • You should have some interfaces to your system that mutate logic; and some that read state. • They should not mix.
  • 10. W H Y ? • Clean code • Reusable code • Self-documentation / Principle of least surprise
  • 11. “But it’s no use now,” thought poor Alice, “to pretend to be two people! Why, there’s hardly enough of me left to make one respectable person!”  command-query responsibility segregation
  • 12. W H AT I S C Q R S ? • You should have separate systems in place for creating and reading data. • This is more often used to describe interfaces at a system or domain level
  • 13. W H AT I S C Q R S ? W R I T E R E A D R E A D
  • 14. W H Y ? • (This is the most controversial of the patterns presented today) • Encourage re-use of APIs and services • Clear single source of truth for data • Read and write can be scaled independently
  • 15. “I could tell you my adventures—beginning from this morning,” said Alice a little timidly “but it’s no use going back to yesterday, because I was a different person then.” event sourcing
  • 16. W H AT I S E V E N T S O U R C I N G ? • The source of truth for your domain is a series of events that tells the system what state has changed. • Any higher fidelity views are “materialised” from this event stream and are second class data citizen
  • 17. W H Y ? • Data restoration for free (if you treat your events right) • Audit log for free • Can understand the state of a system at a given time
  • 18. “It seems very pretty,” she said when she had finished it, “but it’s rather hard to understand!” ( Y O U S E E S H E D I D N ’ T L I K E T O C O N F E S S , E V E N T O H E R S E L F, T H AT S H E C O U L D N ’ T M A K E I T O U T AT A L L . )
  • 19. W H AT Y O U N E E D T O M O D E L … D O M A I N E V E N T S C O M M A N D E V E N T • Requests by a user/system/etc. to change something • Often written in the imperative mood • Meaningful domain events - not just CRUD operations • “Cancel Direct Debit”, “Onboard Customer”, “Submit Meter Read” • A notification that the state of the system has explicitly changed (or that is hasn’t) • Often written as participles • Meaningful domain events - not just CRUD operations • “Direct Debit Cancelled”, “Customer was not onboarded”
  • 20. W H AT Y O U N E E D T O M O D E L … A G G R E G AT E S C O M M A N D E V E N T • The aggregate contains the business logic to validate a command, and understand the impact it should have on the system. • If you remember from DDD: Aggregate is a domain entity. Domain entities should have the knowledge internally to determine whether a command is successful. (Clean Code, SOLID, Feature Envy etc.) • The aggregate will be a noun, and could be “Customer” or “CustomerAggregate” • May be split up for ease, in which case the top-level aggregate is an “aggregate root”. E V E N T E V E N T
  • 21. W H AT Y O U N E E D T O M O D E L … S A G A E V E N T E V E N T • A saga is a state machine that manages processes that span multiple services. These should still be domain processes! • The state of the saga is driven by the events that other services generate. If the saga feels that a change is needed based on the events, it can implement those changes by issuing one or more commands. • A saga should named after a business process, such as “Account Creation” or “Account Creation Saga” E V E N T C O M M A N D
  • 22. Z O O M I N G O U T… A G G R E G AT E W R I T E A P I R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W M AT E R I A L I S E R C O M M A N D
  • 23. Z O O M I N G O U T… A G G R E G AT E W R I T E A P I C O M M A N D R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W M AT E R I A L I S E R
  • 24. Z O O M I N G O U T… A G G R E G AT E W R I T E A P I E V E N T R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W M AT E R I A L I S E R E V E N T E V E N T
  • 25. M AT E R I A L I S E R Z O O M I N G O U T… A G G R E G AT E W R I T E A P I E V E N T R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W E V E N T E V E N T N E W R E C O R D
  • 26. M AT E R I A L I S E R Z O O M I N G O U T… A G G R E G AT E W R I T E A P I R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W N E W R E C O R D
  • 27. Z O O M I N G O U T… A G G R E G AT E W R I T E A P I E V E N T R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E D V I E W M AT E R I A L I S E R E V E N T E V E N T
  • 28. Z O O M I N G O U T… A G G R E G AT E W R I T E A P I R E A D A P I S A G A E V E N T S T O R E M AT E R I A L I S E R M AT E R I A L I S E D V I E W C O M M A N D
  • 29. W H Y ? • All the benefits of the other patterns we’ve discussed • Single, consolidated architecture that scales nicely with the number of teams • Can spin up new microservices with minimal cost down the line
  • 30. “So she was considering in her own mind whether the pleasure of making a daisy-chain would be worth the trouble of getting up & picking the daisies...”
  • 31. M I N I S T RY O F J U S T I C E • https://github.com/ CJSCommonPlatform/ microservice_framework_version_6 • Did the project succeed? Not really. (And the consultancy behind was trashed in the news.) • Did the architecture work? No. Developers not good enough to understand it, Ivory Tower Architecture Function, 8 weeks to get words on a screen.
  • 32. M E T T L E • Challenger bank targeting SMEs. • Did the project succeed? Still going strong. (And the consultancy behind was trashed in the news.) • Did it work? Kind of? After a bit of wrangling. But we didn’t get half of what it promised.
  • 33. P E R S O N A L P R O J E C T • https://github.com/ SwamWithTurtles/decrypto-be/ • Did it work? Yeah, kinda but one person projects are always doomed to succeed.
  • 34. Everything’s got a moral (if only you can find it)