Design Patterns & Software Architecture Flashcards
6 cards from real CPP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Design Patterns & Software Architecture flashcards as text
What is the Singleton design pattern?
Answer: A pattern ensuring a class has only one instance and provides a global access point to it
The Singleton pattern restricts instantiation to one object and provides a static method to access that single instance.
What is the Factory Method design pattern?
Answer: A pattern defining an interface for creating an object but letting subclasses decide which class to instantiate
The Factory Method pattern delegates object creation to subclasses, allowing a class to defer instantiation of the exact type it will use.
What is the Observer design pattern?
Answer: A pattern defining a one-to-many dependency so that when one object changes state, all its dependents are notified automatically
The Observer pattern implements publish-subscribe, where a subject maintains a list of observers and notifies them of state changes.
What is the Decorator design pattern?
Answer: Attaching additional responsibilities to an object dynamically without modifying its class
The Decorator pattern wraps an object to extend its behavior at runtime, providing a flexible alternative to subclassing.
What is layered (n-tier) architecture?
Answer: Organizing code into horizontal layers (presentation, business logic, data) where each layer only communicates with adjacent layers
Layered architecture separates concerns into stacked layers, promoting maintainability and testability by isolating responsibilities.
What is the Strategy design pattern?
Answer: A pattern defining a family of algorithms, encapsulating each one, and making them interchangeable
The Strategy pattern lets you select an algorithm's behavior at runtime by encapsulating each variant in its own class sharing a common interface.