What Are the 7 Core Software Architecture Patterns and When to Use Them?
This article explains the seven fundamental software architecture patterns—layered, multilayer, pipe‑filter, client‑server, MVC, event‑driven, and microservices—detailing their contexts, problems they solve, typical solutions, drawbacks, and suitable application scenarios.
Architecture patterns are reusable solutions to common software‑design problems within a specific context. Many developers still confuse or know little about the differences among these patterns.
The seven most common patterns are:
Layered Architecture
Multilayer Architecture
Pipe‑Filter Architecture
Client‑Server Architecture
Model‑View‑Controller (MVC)
Event‑Driven Architecture
Microservices Architecture
1. Layered Architecture
The classic n‑tier (layered) architecture typically consists of four layers: presentation, business, persistence, and database.
Context: Complex systems evolve independently and need clear separation of concerns.
Problem: Modules must be developed and maintained independently while keeping interactions minimal.
Solution: Divide the system into layers, each providing a cohesive set of services and exposing a single‑direction interface. Layers are marked as closed (requests must pass through the layer below) or open.
Weaknesses: Added latency from traversing multiple layers, higher initial cost and complexity.
Usage: Suitable for small‑to‑medium applications or websites with limited budget and time.
2. Multilayer Architecture
Often used in distributed deployments where the system is split across several logical groups (layers) that may run on different machines.
Context: Need to partition a distributed system into independent execution units.
Problem: How to split the system into multiple compute subsets that communicate via defined connectors.
Weaknesses: High upfront cost and architectural complexity.
Usage: Appropriate for distributed systems requiring clear separation of responsibilities.
3. Pipe‑Filter Architecture
Common in systems that transform streams of data from input to output, such as ETL pipelines or compilers.
Context: Repeated need to convert discrete data streams.
Problem: Need reusable, loosely‑coupled components with simple, generic interaction mechanisms.
Solution: Arrange filters in a pipeline where each filter performs a specific role: source (producer): the entry point of data. map (transformer): converts data. reduce (tester): evaluates conditions. sink (consumer): the final destination.
Weaknesses: Not ideal for highly interactive systems; parsing overhead can affect performance and increase filter complexity.
Usage: Ideal for batch processing, ETL tools, and compiler stages (lexical analysis, parsing, semantic analysis, code generation).
4. Client‑Server Architecture
Many distributed applications share resources or services that multiple clients need to access.
Context: Centralized services must be controlled and made scalable.
Problem: How to manage access, quality of service, and scalability for shared resources.
Solution: Clients send requests to a server component, which processes the request and returns a response.
Weaknesses: The server can become a performance bottleneck and a single point of failure; moving functionality between client and server can be costly.
Usage: Online applications such as email, document sharing, or banking services.
5. Model‑View‑Controller (MVC)
MVC separates an application into three interacting components to manage UI complexity.
Context: User interfaces change frequently and need multiple views of the same data.
Problem: How to keep UI logic independent of business logic while reacting to data changes.
Solution: Divide responsibilities into:
Model – holds application data.
View – renders data and handles user interaction.
Controller – mediates between model and view, managing state changes.
Weaknesses: Overkill for simple UIs; may not fit certain UI toolkits.
Usage: Commonly used in web and mobile application development.
6. Event‑Driven Architecture
Designed for systems that must handle a high volume of asynchronous events and scale with demand.
Context: Need to process independent, asynchronous events generated by applications.
Problem: Build a distributed system that can ingest, route, and process events reliably.
Solution: Deploy event processors that consume events from queues; a scheduler dispatches events to appropriate handlers.
Weaknesses: Performance and error‑recovery can be challenging.
Usage: E‑commerce order processing example:
Order Service creates an OrderCreated event. Customer Service consumes it, attempts to reserve credit, and emits either CreditReserved or CreditLimitExceeded. Order Service then updates the order status accordingly.
7. Microservices Architecture
Monolithic applications become too large and hard to deploy, especially in cloud environments.
Context: A single integrated application cannot efficiently utilize distributed resources.
Problem: Excessive size and complexity hinder support, deployment, and scalability.
Solution: Decompose the system into independent services, each with its own API boundary, database, and possibly its own programming language and team.
Weaknesses: Requires extensive monitoring, service orchestration, and adds operational overhead; costs can increase.
Usage: Suitable for data‑intensive pipelines, such as retail sales reporting where each step (collection, cleaning, normalization, aggregation, reporting) is handled by a separate 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.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
