Architectural Metapatterns
descri
·
2026-05-28
·
via Hacker News: Show HN
关于 Patterns of software architecture are all interrelated ( no pattern is an island ). You can rarely make a product in a pure architectural style, and the chances for it to survive undistorted over years are negligible. Software grows iteratively and adapts to its environment.
Architectural Metapatterns is all about patterns and their relations. It generalizes hundreds of individual patterns into several wider classes ( metapatterns ) each of which can be applied to a local or distributed system to change its properties in a certain way. Rinse and repeat.
The content is lavishly illustrated with intuitive NoUML diagrams. It’s concise and AI-free.
Have a good time!
Here are the web version of the book and presentations that summarize its main content.
作者
Denys Poltorak
Denys is an unemployed C/C++ programmer from Ukraine.
He had 15 years of experience with embedded and high-load systems, nearly half of which he spent leading the development of a project, before he burned out, lost his job, and wrote a book.
用户评价 This book is PHENOMENAL. I program professionally, teach code architecture to teams, and read many books about software patterns and practices. This book is an instant classic, packed with pragmatic wisdom for software programmers, system architects, and development teams. Kudos for creating such an superb addition to the field, and moreover for making it widely available for the benefit of all of us.
Joel Parker Henderson
Head of Software Engineering, Technology Advisor
Architectural Metapatterns helps unravel the complexities surrounding software architecture by describing some common (and not so common) patterns an architect can use to better understand and form architectural solutions. In this book you’ll find hundreds of structure-based patterns encompassing communication, data, modularity, coupling, structure, and lots more, making it a must-read for any software architect.
Mark Richards
Author of Fundamentals of Software Architecture
This magnificent book lets you reason clearly about modern architectural patterns. Modern applications have only a few different types of problem to solve, but each problem has many possible solutions. This book steps through the problems and, for each one, discusses the trade-offs and different approaches in the patterns that solve that problem. After you read it, you'll know how to think about your problems and how to find the right architecture to solve them. This is exactly the kind of book I would have been delighted to sign when I was an editor.
Nathan Torkington
Author of Perl Cookbook
目录
Part 0. Introduction
You’ll find inside
Short table of contents
About this book
Structure of the book
Diagrams
Notation
The architectural religions
What’s wrong with patterns
TLDR
Metapatterns
Architectural patterns
Design space
Structure determines architecture
The system of coordinates
Map and reduce
An example of metapatterns
What does that mean
System topologies
Methodology
The map of system topologies
Monolithic systems
True Monoliths
Monoliths with auxiliary layers
Monoliths with Plugins
Underdeveloped Moduliths
Layered architectures
Ordinary Layers
Scaled Layers
Other layered systems
Plugins family
Plugin Architecture
Separated Presentation
Control patterns
Hexagonal Architecture
Cell
Services area
Barebone services
Services with extensions
Hierarchies of services
Partially merged services
Fragmented patterns
Layers of services
Layered services
Hierarchies
Common motifs
Summary
Part 1. Foundations of software architecture
Modules and complexity
Concepts and complexity
Modules, encapsulation and bounded context
Coupling and cohesion
Development and operational complexity
Composition of modules
Forwarding and duplication
Summary
Forces, asynchronicity, and distribution
Requirements and forces
Conflicting forces
Asynchronous communication
Distribution
The goods and the price
Four kinds of software
Source of inputs
Latency constraints
Control (real-time, hardware input)
Variants
Patterns
Implementation
Interactive (soft real-time, user input)
Variants
Patterns
Implementation
Streaming (continuous, raw data input)
Variants
Patterns
Implementation
Computational (single run, user input)
Variants
Patterns
Implementation
Mixed cases
Camera
3D action game
SQL database
Summary
Arranging communication
Programming and architectural paradigms
Technologies are specialized
Object-oriented (centralized, shared nothing) paradigm – orchestration
Functional (decentralized, streaming) paradigm – choreography
Procedural (data-centric) paradigm – shared data
Composite cases
Reality is more complex
Summary
Orchestration
Roles
Dependencies
Mutual orchestration
Summary
Choreography
Early response
Dependencies
Multi-choreography
Summary
Shared data
Storage
Messaging
Full-featured
Summary
Comparison of communication styles
Part 2. Basic metapatterns
Monolith
Performance
Dependencies
Applicability
Relations
Variants by the internal structure
True Monolith, Big Ball of Mud
(inexact) Lambda Monolith, Monolambda, Lambdalith
(misapplied) Layered Monolith
(misapplied) Modular Monolith (Modulith)
(misapplied) Distributed Monolith
(inexact) Plugins and Hexagonal Architecture
Examples
Single-threaded Reactor (one thread, one task)
Multi-threaded Reactor (a thread per task)
Proactor (one thread, many tasks)
(inexact) Half-Sync/Half-Async (coroutines or fibers)
The state of the art
(inexact) (Re)Actor-with-Extractors (phased processing)
Evolutions
Evolutions to Shards
Evolutions to Layers
Evolutions to Services
Evolutions with Plugins
Summary
Shards
Performance
Dependencies
Applicability
Relations
Variants by isolation
Multithreading
Multiple processes
Distributed instances
Examples
Persistent slice: Sharding, Shards, Partitions, Multitenancy, Cells (Amazon definition)
Persistent copy: Replica
Stateless: Pool, Instances, Replicated Load-Balanced Services, Work Queue, Lambdas
Temporary state: Create on Demand, Actors
Evolutions
Evolutions of a sharded monolith
Evolutions that share data
Evolutions that share logic
Summary
Layers
Performance
Dependencies
Applicability
Relations
Variants by isolation
Synchronous layers, Layered Monolith
Asynchronous layers
A process per layer
Distributed Tiers
Variants of layer roles
Interface (API or UI)
Application (use cases or integration)
Domain (business rules or model)
Generic code (libraries and utilities)
Communication (middleware)
Data (persistence)
Operating system and hardware
Examples
Entity-Control-Boundary (ECB), Entity-Boundary-Control (EBC), Boundary-Control-Entity (BCE)
Domain-Driven Design (DDD) Layers
Three-Tier Architecture
Embedded systems
Evolutions
Evolutions that make more layers
Evolutions that help large projects
Evolutions that improve performance
Evolutions to gain flexibility
Summary
Services
Performance
Dependencies
Applicability
Relations
Variants by isolation
Synchronous modules: Modular Monolith (Modulith)
Asynchronous modules: Modular Monolith (Modulith), Embedded Actors
Multiple processes
Distributed runtime: Backend Actors
Distributed services: Service-Based Architecture, Space-Based Architecture, Microservices
Variants by communication
Direct method calls
RPCs and commands (request/confirm pairs)
Notifications (pub/sub) and shared data
(inexact) No communication
Variants by size
Whole subdomain: (Sub-)Domain Services, Macroservices
Part of a subdomain: Microservices
Class-like: Actors
Single function: FaaS, Nanoservices
Variants by internal structure
Monolithic service
Hexagonal service
Scaled service
Layered service
Cell (WSO2 definition) (service of services), Domain (Uber definition), Cluster
Examples
Service-Based Architecture (SBA), Macroservices
Microservices
Actors
(inexact) Nanoservices (API layer)
(inexact) Device Drivers, Pedestal
Evolutions
Evolutions that restructure services
Evolutions that add layers
Evolutions of individual services
Summary
Pipeline
Performance
Dependencies
Applicability
Relations
Variants by scheduling
Stream processing, Nearline system
Batch processing, Offline system
Examples
Pipes and Filters, Workflow System
Choreographed (Broker Topology) Event-Driven Architecture (EDA), Event Collaboration
Data Mesh
Function as a Service (FaaS), Nanoservices (pipelined)
Evolutions
Summary
Part 3. Extension metapatterns
Middleware
Performance
Dependencies
Applicability
Relations
Variants by functionality
By addressing (channels, actors, pub/sub, gossip)
By flow (notifications, request/confirm, RPC)
By delivery guarantee
By persistence
By structure (Microkernel, Mesh, Broker)
Examples
Persistent Event Log, Shared Event Store
Service Mesh
Message Bus
Event Mediator
Enterprise Service Bus (ESB)
Evolutions
Summary
Shared Repository
Performance
Dependencies
Applicability
Relations
Examples
Shared Database, Integration Database, Data Domain, Database of Service-Based Architecture
Shared File System
Shared Memory
Blackboard
Data Grid of Space-Based Architecture (SBA), Replicated Cache, Distributed Cache
Persistent Event Log, Shared Event Store
(inexact) Stamp Coupling
Evolutions
Summary
Proxy
Performance
Dependencies
Applicability
Relations
Variants by transparency
Variants by placement
Separate deployment: Standalone
On the system side: Sidecar
On the client side: Ambassador
Examples
Firewall, (API) Rate Limiter, API Throttling
Response Cache, Read-Through Cache, Write-Through Cache, Write-Behind Cache, Cache, Caching Layer, Distributed Cache, Replicated Cache
Load Balancer, Sharding Proxy, Cell Router, Messaging Grid, Scheduler
Dispatcher, Reverse Proxy, Ingress Controller, Edge Service, Microgateway
Adapter, Anticorruption Layer, Abstraction Layer, Open Host Service, Gateway, Message Translator, API Service, Cell Gateway, (inexact) Backend for Frontend, Database Access Layer, Data Mapper, Repository, Driver
API Gateway
User Interface, Presentation Layer, Separated Presentation, Command Line Interface (CLI), Graphical User Interface (GUI), Frontend, Human-Machine Interface (HMI), Man-Machine Interface (MMI), Operator Interface
Evolutions
Summary
Orchestrator
Performance
Dependencies
Applicability
Relations
Variants by transparency
Closed or strict
Open or relaxed
Variants by structure (can be combined)
Monolithic
Scaled
Layered
A service per client type (Backends for Frontends)
A service per subdomain (Hierarchy)
A service per use case (SOA-style)
Examples
API Composer, Remote Facade, Gateway Aggregation, Composed Message Processor, Scatter-Gather, MapReduce
Process Manager, Orchestrator
(Orchestrated) Saga, Saga Orchestrator, Saga Execution Component, Transaction Script, Coordinator
Integration (Micro-)Service, Application Service
(inexact) Front Controller
API Gateway
Event Mediator
Enterprise Service Bus (ESB)
Evolutions
Summary
Sandwich
Performance
Dependencies
Applicability
Relations
Examples
Blackboard System
Space-Based Architecture
Service-Based Architecture
Nanoservices
Command Query Responsibility Segregation (CQRS)
(inexact) Replicated Load-Balanced Services, Lambdas
Evolutions
Primary evolutions
Evolutions of the data layer
Evolutions of the application layer
Summary
Part 4. Fragmented metapatterns
Layered Services
Performance
Variants
Orchestrated Three-Layered Services
Dependencies
Relations
Evolutions
Choreographed Two-Layered Services
Dependencies
Relations
Evolutions
Command Query Responsibility Segregation (CQRS)
Dependencies
Relations
Evolutions
Summary
Polyglot Persistence
Performance
Dependencies
Applicability
Relations
Examples with independent storage
Private and Shared Databases
Specialized Databases
Data File, Content Delivery Network (CDN)
Examples with derived storage
Read-Only Replicas
Database Cache, Cache-Aside
Memory Image, Materialized View
Reporting Database, CQRS View Database, Event-Sourced View, Source-Aligned (Native) Data Product Quantum (DPQ) of Data Mesh
Query Service, Front Controller, Data Warehouse, Data Lake, Aggregate Data Product Quantum (DPQ) of Data Mesh
External Search Index
Historical Data, Data Archiving
Evolutions
Summary
Backends for Frontends (BFF)
Performance
Dependencies
Applicability
Relations
Variants
Proxies
Orchestrators
Proxy + Orchestrator pairs
API Gateways
Event Mediators
Evolutions
Summary
Service-Oriented Architecture (SOA)
Performance
Dependencies
Applicability
Relations
Examples
Distributed Monolith
Enterprise SOA
Domain-Oriented Microservice Architecture (DOMA)
(misapplied) Automotive SOA
Nanoservices
Evolutions
Summary
Hierarchy
Performance
Dependencies
Applicability
Relations
Variants by structure (may vary per node)
Polymorphic children
Functionally distinct children
Variants by direction
Top-Down Hierarchy: Orchestrator of Orchestrators, Presentation-Abstraction-Control (PAC), Hierarchical Model-View-Controller (HMVC)
Bottom-Up Hierarchy: Bus of Buses, Network of Networks, Hierarchical Middleware
In-Depth Hierarchy: Cell-Based (Microservice) Architecture (WSO2 version), Segmented Microservice Architecture, Services of Services, Clusters of Services
Evolutions
Summary
Part 5. Implementation metapatterns
Plugins
Performance
Dependencies
Applicability
Relations
Variants
By the direction of communication
By linkage
By granularity
By the number of instances
By execution mode
Examples
True Plugin (or Plug-in)
Ambassador Plugin, Logic Extension
Extension
Addin (or Add-in)
(inexact) Addon (or Add-on)
Summary
Hexagonal Architecture
Performance
Dependencies
Applicability
Relations
Variants by placement of adapters
Adapters on the external component side
Adapters on the core side
Variants by encapsulation
Upper half: Separated Presentation, Open Host Service
Lower half: Pedestal, Abstraction Layer, Anticorruption Layer
Full encapsulation: Ports and Adapters
Examples
Model-View-Presenter (MVP), Model-View-Adapter (MVA), Model-View-ViewModel (MVVM), Model 1 (MVC1), Document-View
Model-View-Controller (MVC), Action-Domain-Responder (ADR), Resource-Method-Representation (RMR), Model 2 (MVC2), Game Development Engine
Pedestal
Ports and Adapters, Hexagonal Architecture
DDD-Style Hexagonal Architecture, Onion Architecture, Clean Architecture
Cell, Cluster, Domain
Summary
Microkernel
Performance
Dependencies
Applicability
Relations
Examples
Operating System
Software Framework, Pluggable Component Framework
Virtualizer, Hypervisor, Container Orchestrator, Distributed Runtime
Interpreter, Script, Domain-Specific Language (DSL)
Configurator, Configuration File
Saga Engine
AUTOSAR Classic Platform
Summary
Mesh
Performance
Dependencies
Applicability
Relations
Variants
By structure
By connectivity
By the number of mesh layers
Examples
Peer-to-Peer Networks
Leaf-Spine Architecture, Spine-Leaf Architecture
Actors
Service Mesh
Space-Based Architecture
Summary
Part 6. Analytics
Comparison of architectural patterns
Sharing functionality or data among services
Direct call
Make a dedicated service
Delegate the aspect
Replicate it
Summary
Pipelines in architectural patterns
Pipes and Filters
Choreographed Event-Driven Architecture
Command Query Responsibility Segregation (CQRS)
Model-View-Controller (MVC)
Summary
Dependency inversion in architectural patterns
Patterns that build around it
Patterns that often rely on it
Patterns that may use it
Summary
Indirection in commands and queries
Command (OLTP) systems
Query (OLAP) systems
A mixed case
Summary
Ambiguous patterns
Monolith
Reactor
Microkernel
Domain Services
Service-Based Architecture
Front Controller
Cells
Nanoservices
Summary
Architecture and product life cycle
Infancy (proof of concept) – Monolith
Childhood (prototype) – Layers
Youth (development of features) – fragmented architectures
Adulthood (production) – ad-hoc composition
Old age (support) – back to Layers
Death (the ultimate release) – Monolith
So it goes
Going back in time
Real-world inspirations for architectural patterns
Basic metapatterns
Monolith
Shards
Layers
Services
Pipeline
Extension metapatterns
Middleware
Shared Repository
Proxy
Orchestrator
Sandwich
Fragmented metapatterns
Polyglot Persistence
Backends for Frontends
Service-Oriented Architecture
Hierarchy
Implementation metapatterns
Plugins
Hexagonal Architecture
Microkernel
Mesh
Summary
The heart of software architecture
Cohesers and decouplers
Code structure and the level of pain
Building a hierarchy
Bidirectional forces
Cohesers
Decouplers
Expansion and contraction
Deconstructing patterns
SOLID principles
Gang of Four patterns
Architectural metapatterns
Choose your own architecture
Project size
Domain features
Runtime performance
Flexibility
Every domain is unique
So it goes
Part 7. Appendices
Appendix A. Acknowledgements.
Appendix B. Books referenced.
Appendix C. Copyright.
Attribution 4.0 International
Section 1 – Definitions.
Section 2 – Scope.
Section 3 – License Conditions.
Section 4 – Sui Generis Database Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Section 6 – Term and Termination.
Section 7 – Other Terms and Conditions.
Section 8 – Interpretation.
Appendix D. Disclaimer.
Appendix E. Evolutions of architectures.
Evolutions of a Monolith that lead to Shards
Implement a Mesh of self-managed shards
Split the data into isolated shards and add a Sharding Proxy
Separate the data layer and add a Load Balancer
Dedicate an instance to each client
Further steps
Evolutions of a Monolith that result in Layers
Divide into Layers
Use a database
Add a Proxy
Add an Orchestrator
Further steps
Evolutions of a Monolith that make Services
Divide into Services
Add or split a service
Divide into a Pipeline
Further steps
Evolutions of a Monolith that rely on Plugins
Support plugins
Isolate dependencies with Hexagonal Architecture
Add an Interpreter (support Scripts)
Evolutions of Shards that share data
Move all the data to a Shared Repository
Use Space-Based Architecture
Use a Shared Repository for the coupled subset of data
Split a service with the coupled data
Evolutions of Shards that share logic
Add a Middleware
Add a Sharding Proxy
Move the integration logic into an Orchestrator
Evolutions of Layers that make more layers
Split the business logic into two layers
Evolutions of Layers that help large projects
Divide the domain layer into Services
Build an Event-Driven Architecture over a Shared Database
Build a Top-Down Hierarchy
Evolutions of Layers to improve performance
Merge several layers
Scale individual layers
Use multiple databases
Evolutions of Layers to gain flexibility
Divide the orchestration layer into Backends for Frontends
Evolutions of Services that restructure services
Add or split a service
Merge services
Cluster services
Evolutions of Services that add layers
Add a Middleware
Use a Service Mesh
Use a Shared Repository
Add a Proxy
Use an Orchestrator
Make a Sandwich
Evolutions of a Pipeline
Promote a service to Front Controller
Add an Orchestrator
Evolutions of a Middleware
Add a secondary Middleware
Merge two systems by building a Bottom-Up Hierarchy
Evolutions of a Shared Repository
Shard the database
Use Space-Based Architecture
Move the data to private databases of services
Deploy specialized databases
Evolutions of a Proxy
Add another Proxy
Deploy a Proxy per client type
Evolutions of an Orchestrator
Subdivide to form Layered Services
Subdivide to form Backends for Frontends
Add a layer of orchestration
Form a Hierarchy
Evolutions of a Sandwich
Add or remove a domain-level service
Split or merge domain-level services
Merge all the domain-level services together
Subdivide both shared layers
Appendix F. Format of a metapattern.
Diagram
Abstract
Performance
Dependencies
Applicability
Relations
Variants and examples
Evolutions
Appendix G. Glossary.
Appendix H. History of changes.
Appendix I. Index of patterns.
Leanpub 无条件、零风险的100%满意保证 在支付后的60天内 ,只需简单点击两下 ,您便可以退书并且取回先前支付的全部金额 。退款是手动处理的,因此可能需要几天时间来完成整个流程。 查看完整条款 。
在10美元的购买中赚取8美元,在20美元的购买中赚取16美元 我们在7.99美元或以上 的购买中支付80%的版税 ,在0.99美元到7.98美元之间 的购买中支付80%的版税减去0.5美元固定费用 。在10美元的销售中您可赚取8美元,在20美元的销售中可赚取16美元 。因此,如果我们以20美元的价格售出5000本未退款的图书 ,您将赚取80,000美元 。
(是的,一些作者在Leanpub上已经赚取了远超过这个数额的收入。)
事实上,作者们通过在Leanpub上写作、出版和销售已经赚取了超过1400万美元 。
了解更多关于在Leanpub上写作的信息
免费更新。无DRM。 如果你购买了Leanpub的书,只要作者更新这本书,你就可以免费获得更新!许多作者使用Leanpub在他们编写书籍的过程中发布他们的作品。所有读者都可以获得免费更新,无论他们何时购买的书或他们支付了多少钱(包括免费)。
大多数Leanpub书籍都提供PDF(适用于计算机)、EPUB(适用于手机和平板电脑)和MOBI(适用于Kindle)格式。书籍包含的格式会显示在此页面的右上角。
最后,Leanpub的书籍没有任何DRM版权保护的限制,所以你可以轻松地在任何支持的设备上阅读它们。
了解更多关于Leanpub的电 子书格式以及在哪里阅读它们
在 Leanpub 上写作和出版 作者与出版社使用 Leanpub 来出版正在写作中和已完成的书籍,就像这本书一样。你也可以使用 Leanpub 来撰写、出版和销售你的作品!Leanpub 是功能强大的平台,非常适合认真的作者。它结合了简单、优雅的写作与出版流程,以及一个可销售正在写作中的电子书的线上商店。Leanpub 是作家的神奇之笔:只需编写纯文本,然后点击按钮即可出版你的电子书。真的就是这么简单。
学习更多关于在 Leanpub 上写作的信息
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。