Software Architecture Patterns
Software Architecture Patterns
What an Architecture Pattern Does
A software architecture pattern is a reusable way to organize a software system. It provides a high-level structure for assigning responsibilities to components and defining how those components interact. Patterns help address recurring design challenges, such as scaling to more users, making changes safely, handling failures, and keeping code understandable.
A pattern is a guide rather than a universal solution. Every architecture involves trade-offs, and the appropriate choice depends on the system’s requirements, constraints, and development team.
1. Layered Architecture
Layered architecture organizes an application into distinct layers, each responsible for a particular kind of work. A common arrangement includes:
Presentation layer: Displays information and receives input from users, such as through a website or mobile app.
Application layer: Coordinates tasks and workflows, connecting user requests with the relevant system operations.
Business or domain layer: Contains the core rules and logic that define how the application works.
Data layer: Stores and retrieves information, often through a database or another data store.
The central principle is separation of concerns: each layer has a defined responsibility rather than mixing user interface, business rules, and data access in the same code. For example, an online store might use the presentation layer to display a product page, the business layer to calculate prices and validate an order, and the data layer to retrieve product and order records.
Advantages
Layers can often be developed, tested, and maintained separately.
A change in one layer may have limited impact on the others when their boundaries are well designed.
The structure makes responsibilities easier to understand and can simplify troubleshooting.
Layers can support flexibility and scalability as the application changes.
Limitations
Too many layers can make the system unnecessarily complex.
Each layer adds communication and processing overhead, which can create performance bottlenecks.
The architecture works best when the boundaries and responsibilities are chosen to suit the application rather than added mechanically.
Typical uses
E-commerce platforms and banking applications commonly use layered structures. For example, a banking app can separate its user interface, transaction rules, and account data management.
2. Client–Server Architecture
Client–server architecture divides responsibilities between clients and a central server, or group of servers.
A client sends requests for data or services and uses the responses. Examples include a web browser, a mobile app, or an email application.
A server manages resources and processes requests, such as storing messages, retrieving records, or providing a service.
A library provides a useful analogy: the server is like the library’s collection and service desk, while a client is a visitor requesting a particular resource. The server centrally manages access rather than requiring every client to maintain its own copy of all resources.
Advantages
Centralized management makes it easier to maintain resources and apply consistent security controls.
Servers can manage and coordinate access to shared data and services.
Updates to server-side resources can be made centrally.
Limitations
A server can become a single point of failure: if it stops operating, clients may lose access to its services.
Central servers can become performance bottlenecks if they receive more requests than they can handle.
Systems commonly use redundancy and backup mechanisms to reduce the risk of service interruption.
Typical uses
Email is a familiar example. An email server stores messages and manages sending and receiving, while an email app acts as the client through which a user accesses and manages messages.
3. Event-Driven Architecture
Event-driven architecture structures a system around events: significant actions or changes that other parts of the system can respond to. Events may come from user actions, sensor readings, transactions, or internal system changes.
Instead of relying only on a fixed sequence of steps, components respond when relevant events occur. One event may trigger one or more further actions, much like a chain reaction. For instance, a transaction event might prompt a fraud-monitoring component to examine the transaction and raise an alert if it appears suspicious.
Advantages
It supports responsive systems that need to react quickly to changing conditions.
Components can respond to events without requiring every part of the system to follow one fixed workflow.
It is well suited to real-time or near-real-time processing.
Limitations
Events may be processed asynchronously and concurrently, making the system harder to design, test, and debug.
Developers need to manage reliability and ensure that events are handled correctly.
Poorly coordinated event processing can cause unintended behavior, such as duplicate actions or missed updates.
Typical uses
Event-driven designs are useful in:
Stock-trading platforms and online games, where timely reactions matter.
Real-time analytics dashboards that update as new data arrives.
Fraud-detection systems that monitor transactions and trigger alerts.
Anti-lock braking systems, which respond to sensor data to help prevent a wheel from locking.
4. Microkernel Architecture
Microkernel architecture has a small core system that provides essential functionality, with additional features supplied by separate plug-in modules. The core establishes the foundation; plug-ins extend it for particular needs.
The design resembles a baseplate with interchangeable building blocks. A plug-in can add a specialized capability without requiring the entire core system to be redesigned.
Advantages
Modularity allows features to be added, removed, or updated independently.
The system can be adapted to different users or environments by selecting different plug-ins.
A change to one plug-in can often be made without disrupting unrelated components.
Limitations
Communication between the core and plug-ins can become complicated as the system grows.
A minimal core may require developers to build features that a more comprehensive system would already provide.
Plug-ins need suitable interfaces so that they can work reliably with the core.
Typical uses
Operating systems are a common example. A kernel handles foundational tasks such as memory management and process scheduling, while device drivers and other components provide specialized support for particular hardware or capabilities.
5. Microservices Architecture
Microservices architecture divides an application into a collection of relatively small, independent services. Each service focuses on a specific task or area of functionality, and the services cooperate to provide the complete application.
For example, an online streaming platform might separate user authentication, content recommendations, and other capabilities into different services. Teams can work on individual services without needing to change the entire application at once.
Advantages
Services can be developed, deployed, and updated independently.
A heavily used service can often be scaled separately from less-used services.
Independent development can speed up work when service responsibilities and boundaries are clear.
Limitations
Services must communicate and coordinate over a network, adding operational and design complexity.
As the number of services grows, network congestion and communication overhead can become concerns.
Each service and each connection between services creates security considerations.
Independent services still need reliable integration and monitoring to behave as a complete system.
Typical uses
Large platforms such as streaming services may use microservices to support features such as authentication and recommendations. The pattern is especially relevant when different parts of a large application have distinct workloads or need to be developed and scaled independently.
6. Space-Based Architecture
Space-based architecture distributes processing and data handling across multiple nodes rather than relying on a single powerful server. The nodes work together and may access shared data held in a distributed memory space or data grid. This approach is sometimes associated with cloud-based or grid-based system designs.
A large warehouse provides an analogy: many robots work on different tasks while accessing shared inventory. In a software system, multiple processing nodes handle work in parallel, allowing the system to manage large workloads by adding capacity.
Advantages
Work can be distributed across nodes to support high volumes of traffic or data.
Capacity can be increased by adding more processing units.
The architecture can support applications with many simultaneous users or transactions.
Limitations
Distributed systems are more complex to design and operate than centralized systems.
Data consistency must be managed across different nodes.
Communication between nodes can introduce latency and affect performance if it is not handled carefully.
Typical uses
This pattern can support large e-commerce platforms that process many transactions simultaneously and online gaming platforms that serve large numbers of interacting players.
7. Master–Slave (Primary–Secondary) Architecture
Master–slave architecture, also called primary–secondary architecture, assigns a coordinating role to one component and task-execution roles to others.
The master, or primary component, makes decisions, assigns work, or coordinates access to data.
The slaves, or secondary components, carry out assigned tasks and report results.
The construction-site analogy illustrates the division of labor: a foreperson coordinates the work, while workers complete assigned tasks. In software, secondary components may perform work in parallel or maintain copies of data.
Advantages
The system can scale by adding more worker components to handle more work.
Work may continue if one worker becomes unavailable, provided the task can be reassigned.
The division of responsibilities can make coordination and processing more orderly.
Limitations
The master can become a single point of failure. If it fails, the rest of the system may be unable to coordinate work.
A backup master and failover mechanisms can allow another component to take over.
Communication between the master and many secondary components can become complicated or slow, especially in large systems.
Typical uses
Database replication: Data is copied to multiple servers so that another server can be used if one fails.
Load balancing: A coordinating component distributes incoming traffic among several servers to help prevent any one server from becoming overloaded.
8. Pipe-and-Filter Architecture
Pipe-and-filter architecture processes data through a sequence of independent components called filters. Each filter performs a particular operation and passes its output to the next filter through a connection called a pipe.
For example, a data-processing workflow may transform, refine, or inspect data at successive stages. Each filter has a defined task, rather than carrying out the entire workflow itself.
Advantages
Filters can be added, removed, or rearranged to change the processing workflow.
Independent filters can be reused in multiple pipelines.
The modular structure makes individual processing stages easier to identify and work on.
Limitations
If the final output is incorrect, tracing the problem may require checking each filter in sequence.
Filters need compatible assumptions about the data they receive and produce.
The data format and transfer between filters may constrain the design.
Typical uses
Compilers: Source code passes through stages such as lexical analysis, parsing, and code generation.
Image processing: A sequence of filters may apply effects such as blurring, sharpening, or color correction.
9. Broker Architecture
Broker architecture uses a broker to coordinate communication between clients and services. Clients send requests to the broker, which routes them to appropriate servers or services. The broker acts as an intermediary, so clients and services do not need to communicate directly in every case.
The broker resembles a marketplace intermediary that connects buyers and sellers. In software, it helps route requests or messages and can support communication among different components.
Advantages
Clients and services are decoupled: a client can make a request without needing to manage the details of which service processes it.
Servers can sometimes be added or removed without changing every client.
A broker can redirect requests if a server fails, improving resilience when appropriate mechanisms are in place.
It can help connect otherwise separate applications or services.
Limitations
The broker’s routing logic, load distribution, and security need careful design.
The broker can become a single point of failure if it is not backed by suitable redundancy or failover mechanisms.
It may become a bottleneck if it cannot handle the volume of messages or requests.
Typical uses
Enterprise systems that integrate applications such as customer relationship management, enterprise resource planning, and human resources systems.
Message-broker systems, such as RabbitMQ or Apache Kafka, which support message exchange between applications or services.
10. Blackboard Architecture
Blackboard architecture uses a central shared data store—the blackboard—where multiple specialized components contribute information and work toward a solution. Components can read information already present, add new information, and propose results.
The pattern resembles a group of specialists collaborating around a shared board. Each specialist contributes a different kind of expertise, and the solution develops as relevant information accumulates.
Advantages
Different components can contribute specialized knowledge without directly depending on one another.
The approach supports problems where information is incomplete or uncertain and a solution emerges gradually.
Components can work on different aspects of the same problem through the shared store.
Limitations
The central store becomes complex to manage when many components contribute at once.
Data consistency and synchronization are important to prevent conflicting or unreliable results.
The system needs a way to coordinate contributions and determine how partial results fit together.
Typical uses
Speech recognition is an example. Different modules may analyze an audio signal, identify speech sounds, match words, and interpret meaning, contributing their findings to the shared blackboard.
11. Interpreter Architecture
Interpreter architecture defines a way to represent instructions in a particular language and process those instructions. An interpreter reads instructions and executes or evaluates them according to the language’s rules.
A programming-language interpreter, for example, processes human-readable code and translates its meaning into actions the computer can perform. Interpreters can also be created for specialized languages designed for a particular domain.
Advantages
A domain-specific or scripting language can make specialized rules easier to express.
The language can be tailored to the needs of a particular application or user group.
Rules can be evaluated by the application without requiring each rule to be hard-coded into the main program.
Limitations
Interpreted execution may be slower than compiled execution because instructions are processed during runtime.
Debugging can be more difficult because the system includes an additional layer that translates and evaluates instructions.
The language’s grammar and behavior must be defined clearly.
Typical uses
A business application might use a rule engine with a specialized language for expressing business rules. An interpreter then evaluates those rules against application data. Programming languages such as Python and JavaScript also rely on interpreters in common execution environments.
12. Model–View–Controller (MVC)
Model–View–Controller (MVC) separates an application into three responsibilities:
Model: Represents the application’s data and core logic.
View: Presents information to the user.
Controller: Receives user input and coordinates actions, including updates to the model.
For an online store, the product catalog and related data belong to the model, actions such as adding an item to a cart are handled through the controller, and the product pages shown to the user are views.
Advantages
Separating data, user interaction, and presentation makes an application more organized.
Components can be reused and tested more easily when responsibilities are separated.
Changes to one part of the application are less likely to cause a chain of unrelated changes.
Limitations
A large application with many views and controllers can become complicated to coordinate.
For a small, simple application, MVC may add more structure and overhead than the project needs.
Typical uses
MVC is widely used in web development and is most useful when an application benefits from a clear separation between data, user input, and what users see.
13. Repository Pattern
The repository pattern provides an interface between an application’s core logic and its data-access mechanisms. The repository handles operations for retrieving and saving data while hiding the details of the underlying database or data store.
The pattern resembles a museum curator who mediates between visitors and a collection. Users interact with the curator rather than accessing and managing the collection directly. In software, the application’s domain logic interacts with a repository rather than depending directly on database details.
Advantages
It separates data management from the application’s core logic.
It can make code easier to test and maintain.
If the data store or data-access logic changes, the repository may be updated without requiring changes throughout the rest of the application.
Limitations
For an application with very simple data-access needs, a repository may add unnecessary complexity.
Designing a general-purpose repository that handles many different kinds of operations can be challenging.
Typical uses
The pattern is useful when an application has substantial or complex data-access needs and needs a clear boundary between its domain logic and its data store.
14. Strategy Pattern
The strategy pattern defines a family of algorithms, encapsulates each one separately, and allows the application to select among them. An algorithm can be exchanged for another without redesigning the parts of the application that use it.
A navigation application, for instance, could offer different route-selection strategies: one that favors the shortest distance, another that favors the fastest journey, and another that avoids toll roads.
Advantages
Algorithms can be selected according to the user’s needs or the current situation.
Each algorithm can be tested independently.
Strategies can be reused in different parts of an application or in other applications.
New strategies can be added without changing all existing code that uses them.
Limitations
If there are only one or two simple algorithms, the pattern may add unnecessary complexity.
Separating algorithms is less useful when they are very similar and do not need to vary independently.
Typical uses
The pattern is useful when an application needs to choose between multiple approaches to the same task, such as different routing, pricing, or sorting algorithms.
Comparing the Patterns by Their Main Design Problem
Patterns that organize responsibilities
Layered architecture: Separates an application into layers with distinct responsibilities.
MVC: Separates application data and logic, user input, and presentation.
Microkernel architecture: Keeps a small core and adds capabilities through plug-ins.
Patterns that coordinate communication or work
Client–server: Connects clients that request services with servers that provide them.
Broker: Routes requests or messages between clients and services.
Master–slave: Uses a coordinating primary component to assign work to secondary components.
Event-driven: Lets components respond to events or changes.
Patterns that process, distribute, or combine information
Pipe-and-filter: Processes data through a sequence of specialized filters.
Blackboard: Lets specialized components contribute to a shared problem-solving space.
Space-based: Distributes processing and data handling across multiple nodes.
Repository: Provides an interface between application logic and data storage.
Interpreter: Processes instructions written in a defined language.
Strategy: Makes a choice among interchangeable algorithms.
Choosing an Appropriate Pattern
There is no single pattern that is best for every project. A sound choice begins with understanding the system’s requirements and constraints.
1. Identify the project’s needs
Important factors include:
Size and complexity: A small application may not benefit from structures intended for large systems.
Performance: Some patterns add communication or processing overhead.
Scalability: Systems expecting increasing traffic may need ways to distribute work.
Security: Centralized components and communication between services create different security concerns.
Reliability: Systems that must remain available need to account for component failures.
Budget and resources: A complex architecture may require more development and operational effort.
2. Consider the development team
A pattern should be understandable and workable for the team that will build and maintain the application. The most fashionable or technically elaborate option is not automatically the most appropriate; the team’s skills and experience affect how successfully a design can be implemented.
3. Match strengths to requirements
If scalability and fault tolerance are central concerns, microservices or space-based architecture may be worth considering.
If maintainability and clear separation of responsibilities are priorities, layered architecture or MVC may be suitable.
If the system handles complex data access, the repository pattern may provide a useful boundary.
If data must pass through several processing stages, pipe-and-filter may fit the workflow.
If a system must react to rapid changes or incoming signals, event-driven architecture may be appropriate.
These are starting points rather than automatic rules. Each pattern’s limitations also need to be evaluated.
4. Evaluate trade-offs
No pattern provides every benefit without cost. A design that improves modularity may add coordination work; a design that supports scaling may make data consistency harder; and a highly flexible design may be unnecessary for a simple application.
The decision should be based on which compromises best support the project’s goals. Patterns can also be combined or adapted when a single pattern does not address every requirement.
Key principle: Architecture patterns are guides for making design decisions, not strict rules. A good architecture balances structure and flexibility to produce software that is reliable, maintainable, and able to adapt to changing user needs.

Ask anything
We've read this whole study set, so questions about it get the best answers.