Architectural Patterns and Styles Flashcards
6 cards from real CPSA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Architectural Patterns and Styles flashcards as text
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?
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.
Which of the following is a primary characteristic and a key advantage of the Microservices architectural style?
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.
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?
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.
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?
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.
What is the key distinction between an architectural style and an architectural pattern?
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.
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?
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.