What Are the 7 Core Software Architecture Patterns and When to Use Them?
This article explains seven common software architecture patterns—layered, multi‑layer, pipe‑filter, client‑server, MVC, event‑driven, and microservices—detailing their contexts, problems they solve, typical structures, strengths, weaknesses, and suitable application scenarios to help developers choose the right architecture for their projects.
Architecture patterns are reusable solutions to common problems in software architecture within a given context.
A pattern is a solution to a specific problem in a particular context.
Many developers still confuse or know little about the differences among software architecture patterns.
Generally, there are seven main architecture patterns:
Layered Architecture
Multi‑Layer Architecture
Pipe‑Filter Architecture
Client‑Server Architecture
Model‑View‑Controller (MVC) Architecture
Event‑Driven Architecture
Microservices Architecture
Layered Architecture
The most common pattern is the layered (or n‑tier) architecture, typically consisting of four layers: presentation, business, persistence, and database.
Each layer has a specific role: the presentation layer handles the user interface, the business layer contains core logic, the persistence layer manages data storage, and the database layer interacts with the database. Layers communicate only in one direction, preventing requests from skipping layers.
Weaknesses: performance overhead due to multiple layers, higher initial cost and complexity.
Typical use: small to medium‑sized applications where clear separation of concerns is beneficial.
Multi‑Layer Architecture
Similar to layered architecture but emphasizes logical grouping of components into distinct layers, often used in distributed systems.
It helps manage complexity by isolating concerns, but also introduces higher upfront cost and complexity.
Pipe‑Filter Architecture
The pipe‑filter pattern processes data through a series of independent filters connected by pipes.
Typical components:
Producer ( source): the start of the data flow.
Transformer ( map): converts data.
Tester ( reduce): evaluates conditions.
Consumer ( sink): the end of the flow.
Weaknesses: not ideal for highly interactive systems; parsing and re‑parsing can hurt performance and increase filter complexity.
Use cases: data‑processing pipelines such as ETL tools, compilers, or any scenario requiring sequential transformation of streams.
Client‑Server Architecture
In this model, a client component sends requests to a server component and waits for a response; the server processes the request and replies.
Strengths: centralised control of shared resources and services, easier scalability and availability.
Weaknesses: the server can become a performance bottleneck and a single point of failure; moving functionality between client and server can be costly.
Typical applications: online services such as email, document sharing, or banking systems.
Model‑View‑Controller (MVC) Architecture
MVC separates an application into three components:
Model – holds the data and business logic.
View – presents data to the user and handles interaction.
Controller – mediates between model and view, managing state changes.
Weaknesses: added complexity may not be justified for simple UIs; some UI toolkits do not map cleanly to MVC.
Use cases: web and mobile applications where a clear separation between UI and business logic is needed.
Event‑Driven Architecture
This pattern provides computational and informational resources to handle asynchronous events, scaling from small to large systems.
Events are placed in queues; a scheduler pulls events based on policies and dispatches them to appropriate processors.
Weaknesses: performance and error‑recovery can be challenging.
Use case example: an e‑commerce system where an Order Service emits an OrderCreated event, a Customer Service processes credit reservation and may emit CreditLimitExceeded, and the Order Service updates order status accordingly.
Microservices Architecture
Applications are decomposed into independent services, each with its own API boundary, database, and deployment lifecycle. Services can be written in different languages and managed by separate teams.
Weaknesses: requires robust monitoring, service orchestration, and handling of inter‑service failures; operational overhead and cost increase.
Typical scenarios: large‑scale systems with extensive data pipelines, such as retail reporting, where each processing step (collection, cleaning, aggregation, reporting) is handled by a dedicated microservice.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
