CPSA Architectural Patterns and Styles Questions and Answers — Questions and Answers
Question 1: A team is developing a large enterprise application and wants to ensure a strict separation of concerns between the user interface, business logic, and data access components. Changes in the database schema should have minimal impact on the UI code. Which architectural pattern is MOST suitable for this requirement?
- Pipe-and-Filter
- Layered Architecture (Correct answer)
- Microservices
- Client-Server
Correct answer: Layered Architecture
The Layered Architecture pattern is the classic solution for separating concerns into horizontal tiers, such as a presentation layer, a business logic layer, and a data access layer. This structure ensures that dependencies flow in one direction (typically from UI down to the database) and that a layer only interacts with the layer directly beneath it, thus isolating changes.
Question 2: Which of the following is a primary characteristic and a key advantage of the Microservices architectural style?
- All services must share a single, centralized database to ensure data consistency.
- Services can be developed, deployed, and scaled independently of each other. (Correct answer)
- Communication between services is typically handled through direct, in-memory function calls for maximum performance.
- It simplifies overall system monitoring and distributed transaction management.
Correct answer: Services can be developed, deployed, and scaled independently of each other.
The core principle of a microservices architecture is to structure an application as a collection of small, autonomous services. This autonomy allows each service to be developed, deployed, and scaled independently, which increases agility and resilience. Sharing databases is an anti-pattern, communication is over networks (not in-memory calls), and distributed systems inherently add complexity to monitoring and transaction management.
Question 3: An architect is designing a system for processing large volumes of data through a series of sequential, independent transformation steps. For example, raw data is first validated, then enriched, then filtered, and finally aggregated. Which architectural pattern is specifically designed for this type of processing pipeline?
- Layered Architecture
- Event-Driven Architecture
- Pipe-and-Filter Architecture (Correct answer)
- Model-View-Controller (MVC)
Correct answer: Pipe-and-Filter Architecture
The Pipe-and-Filter architecture structures a system that processes a stream of data where each processing step is encapsulated in a 'filter' component. Data is passed between filters through 'pipes'. This pattern is ideal for sequential data transformations, such as in compilers or data processing pipelines, as each filter can operate independently and concurrently.
Question 4: A software architect is designing an online retail platform. The system needs to react to various business occurrences—such as 'order placed,' 'payment processed,' or 'item shipped'—in a highly decoupled and asynchronous manner. Multiple downstream systems (e.g., inventory, notifications, analytics) need to be notified of these occurrences without the upstream service being aware of them. Which architectural style best supports these requirements?
- Client-Server
- Monolithic Architecture
- Layered Architecture
- Event-Driven Architecture (Correct answer)
Correct answer: Event-Driven Architecture
Event-Driven Architecture (EDA) is designed around the production, detection, and consumption of events. This style allows for highly decoupled components (producers and consumers) that communicate asynchronously. It is perfect for scenarios where an action in one part of the system needs to trigger workflows in multiple, unrelated parts of the system without creating direct dependencies.
Question 5: What is the key distinction between an architectural style and an architectural pattern?
- A style is a low-level solution for a specific coding problem, while a pattern is a high-level system structure.
- There is no practical difference; the terms are used interchangeably in the industry.
- A style is a high-level, abstract concept about system organization, while a pattern is a concrete, reusable solution to a recurring problem within that style. (Correct answer)
- A pattern describes the physical deployment view, while a style describes the logical component view.
Correct answer: A style is a high-level, abstract concept about system organization, while a pattern is a concrete, reusable solution to a recurring problem within that style.
An architectural style is a high-level, conceptual way of organizing a system (e.g., Client-Server, Event-Driven). An architectural pattern provides a more concrete, reusable solution to a common problem that often helps implement a style (e.g., MVC is a pattern often used within a Client-Server style). The key difference is the level of abstraction and scope.
Question 6: An architect is evaluating the trade-offs of using a strict Layered Architecture for a high-performance computing application. Which of the following is a well-known performance disadvantage of this pattern?
- It inherently supports parallel processing of a single request across multiple layers.
- Requests often have to pass through multiple layers, each adding overhead, even if the intermediate layers perform no logic. (Correct answer)
- It is difficult to enforce separation of concerns between layers.
- The pattern requires each layer to be deployed as an independent microservice, increasing network latency.
Correct answer: Requests often have to pass through multiple layers, each adding overhead, even if the intermediate layers perform no logic.
A significant drawback of the layered pattern is the performance overhead incurred as requests and data must pass sequentially through each layer. This can be inefficient if a request only needs services from a lower layer, but must still pass through intermediate layers that act only as pass-throughs, adding unnecessary latency.
A team is developing a large enterprise application and wants to ensure a strict separation of concerns between the user interface, business logic, and data access components.
Changes in the database schema should have minimal impact on the UI code.
Which architectural pattern is MOST suitable for this requirement?