// blog › architecture patterns
ARCHITECTURE PATTERNS
Architecture patterns vs design patterns vs messaging patterns
On this page
- Architecture patterns decide the deployable parts and how they fail, scale and change. Design patterns decide how code inside one part is organised.
- Messaging patterns sit between them: how parts exchange work without waiting for each other.
- An event-driven architecture is built from messaging patterns, and every service in it uses ordinary design patterns.
- Start from the problem, not the pattern. Each one adds moving parts you then have to run.
Architecture patterns vs design patterns is a question that comes up as soon as you read two pattern catalogues side by side. Add messaging patterns and it gets worse, because the same words, such as "event" and "publish/subscribe", turn up in all three. The short answer: they describe the same software at three zoom levels. Architecture patterns shape the whole system. Design patterns shape the code inside one program. Messaging patterns shape how separate programs pass work to each other. This guide explains each, shows how they fit together, and says when to reach for which.
Architecture patterns: the shape of the system
An architecture pattern, which Microsoft's Azure Architecture Center calls an architecture style, is a family of systems that share the same kinds of parts and the same rules for connecting them. Common ones:
- Layered or n-tier: presentation, business logic and data, each calling only the layer below.
- Web-queue-worker: a web front end hands slow jobs to a worker through a queue.
- Microservices: small services, each owning one business capability and its own data, deployed on their own.
- Event-driven: producers publish events and consumers react, with a broker in between so neither knows the other.
- Serverless: managed functions and services that run on demand and are billed per use. It usually comes with an event-driven shape.
The point of a style is its constraints. Microservices, for example, say a service's data is private to it. Keep that rule and you can deploy services one at a time and contain faults; break it and you have a distributed monolith.
Some decisions at this level are not called styles but behave like them. The disaster recovery strategies, from backup and restore to active/active, decide what runs in a second Region and what it costs (RTO and RPO explained). Pooled and silo tenancy decide which customers share infrastructure (multi-tenant SaaS on AWS). CQRS, which splits the model you write to from the model you read, is listed in Microsoft's design patterns catalogue, yet with separate stores it changes the shape of the whole system. The labels blur; what matters is the zoom level of the decision.
Design patterns: the shape of the code
"Design patterns" first meant the 23 in Design Patterns (1994) by Gamma, Helm, Johnson and Vlissides, the "Gang of Four". They are grouped as creational (Factory Method, Builder), structural (Adapter, Decorator) and behavioural (Strategy, Observer). They live inside one program. Swap a Strategy for a long if chain and nothing on the architecture diagram moves.
Watch the wording in cloud documentation. Microsoft's "Cloud design patterns" and AWS Prescriptive Guidance's "cloud design patterns" are not Gang of Four patterns. Retry, Circuit Breaker, Saga and Strangler Fig are patterns for distributed systems, closer to the messaging level than to classes and objects.
Messaging patterns: how programs talk
Enterprise Integration Patterns (2003) by Gregor Hohpe and Bobby Woolf catalogues 65 patterns for connecting programs with messages. They are technology-neutral, which is why they still fit SQS, Service Bus, Kafka and EventBridge. The ones you meet most:
- Point-to-point channel: a queue. Each message is handled by exactly one receiver.
- Publish/subscribe channel: a topic. Every subscriber gets its own copy, as with an SNS topic or an EventBridge bus with several rules.
- Competing consumers: several workers read one queue and share the load. It only works on a point-to-point channel; on a topic, extra subscribers just get duplicates. Scaling those workers on queue depth is what KEDA queue workers draws.
- Dead letter channel: where a message goes when it cannot be delivered. Cloud queues widen the idea: SQS moves a message to its dead-letter queue once it has been received more times than the redrive policy's
maxReceiveCountwithout being deleted. - Request/reply: the request goes out on one channel and the answer comes back on another, matched by a correlation identifier.
The saga is not in the book, but it lives at this level. It runs one business transaction across several services as a chain of local transactions, and undoes finished steps with compensating transactions if a later one fails. In choreography, each service reacts to the previous one's event and there is no coordinator. AWS suggests it for a few participants; past that, the flow becomes hard to follow. In orchestration, a coordinator such as a Step Functions workflow tells each service what to do next. It suits many participants, but the coordinator is one more thing that can fail.
How the three fit together
Take the invoice pipeline on AWS. Its architecture is event-driven, repeated in self-contained Regional cells. Zoom in and it is made of messaging patterns: EventBridge rules are content-based routers, an SNS topic per stage is publish/subscribe, each SQS queue with Lambda readers is a point-to-point channel with competing consumers, and every queue has a dead-letter queue. Zoom into one Lambda function and you find design patterns: perhaps an Adapter around the finance system's API.
The Observer pattern and publish/subscribe are the same idea at two scales. An Observer's subject holds a list of its observers and calls them in the same process. A pub/sub topic sits in a broker, so the publisher does not know who is listening, and a slow subscriber cannot hold it up.
When to reach for which
- Architecture when the question is about teams, deployment, failure or cost: how many deployable parts, and what fails together? Decide early; it is the most expensive to change.
- Messaging when one part must hand work to another without waiting: who receives this, how many times, and where does it go when it fails?
- Design when code is hard to change or test.
Microsoft's advice for its catalogue holds for all three: choose a pattern for the problem in front of you, not the technology you want to use. Many systems never need a saga.
Drawing patterns in archhy
Draw one diagram per zoom level. On an architecture diagram, put the messaging pattern in the rail label, such as "Competing consumers" or "To DLQ after 5 receives", and dash the failure paths. Design patterns rarely belong on it; they belong in the code.
Frequently asked questions
Is microservices a design pattern or an architecture pattern?
An architecture pattern. It decides how the system splits into deployable services and who owns which data. The code inside each service still uses ordinary design patterns.
Is event-driven architecture the same as publish/subscribe?
No. Event-driven architecture is the style of the whole system. Publish/subscribe is one messaging pattern it uses, usually alongside queues, routers and dead-letter queues.
Should a saga use choreography or orchestration?
Choreography suits a short flow with few services. Once several services take part, or you need to see where each transaction is, an orchestrator such as Step Functions is easier to follow.
Are messaging patterns still relevant with managed cloud services?
Yes. SQS, SNS, EventBridge and Service Bus are implementations of them. Knowing the pattern tells you what a service can do, and what it will not do for you, such as removing duplicates.
based on Original archhy explainer, drawing on Enterprise Integration Patterns (Hohpe and Woolf), Design Patterns (Gamma, Helm, Johnson and Vlissides), the Azure Architecture Center's architecture styles and cloud design patterns, and AWS Prescriptive Guidance's saga patterns.


