🌍 Worldwide · Programming
Design Pattern Syllabus
Roadmap to Design Pattern. The full Design Pattern syllabus: 5 chapters and 39 topics, with 51 flashcards written against it.
Design Pattern syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Design Pattern, not a summary of it.
-
Creational Patterns
5 topics- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
-
Structural Patterns
7 topics- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
-
Behavioral Patterns
11 topics- Chain of Responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
-
Concurrency Patterns
8 topics- Active Object
- Monitor Object
- Scheduler
- Thread Pool
- Read-Write Lock
- Producer-Consumer
- Reactor
- Balking
-
Architectural Patterns
8 topics- MVC (Model-View-Controller)
- MVVM (Model-View-ViewModel)
- Microservices
- Layered Architecture
- Event-Driven Architecture
- Service-Oriented Architecture
- Hexagonal Architecture
- CQRS (Command Query Responsibility Segregation)
Design Pattern flashcards
The complete Design Pattern deck: 51 questions with worked answers.
Into which three families does the classic Gang of Four (GoF) taxonomy classify design patterns?
Creational, Structural, and Behavioral patterns.
Classify each of these as Creational, Structural, or Behavioral: Singleton, Adapter, Command.
Singleton = Creational; Adapter = Structural; Command = Behavioral.
What is the intent of the Singleton pattern?
Ensure a class has only one instance and provide a global point of access to that instance.
Name two common techniques used to make a Singleton thread-safe in a lazy-initialization scenario.
Double-checked locking (with a volatile field) and the initialization-on-demand holder idiom (static inner holder class); an eager static instance also avoids the race entirely.
Why is a private constructor essential to the Singleton pattern?
It prevents any external code from instantiating the class with 'new', forcing all access through the controlled static accessor that returns the sole instance.
What is the intent of the Factory Method pattern?
Define an interface for creating an object, but let subclasses decide which class to instantiate, deferring instantiation to subclasses.
In Factory Method, what are the four participant roles?
Product (interface), ConcreteProduct, Creator (declares the factory method), and ConcreteCreator (overrides the factory method to return a ConcreteProduct).
What is the intent of the Abstract Factory pattern?
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
How does Abstract Factory differ from Factory Method?
Factory Method uses inheritance and a single method to create one product; Abstract Factory uses composition (an object) to create whole families of related products, typically via multiple factory methods.
What is the intent of the Builder pattern?
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Name the four participants of the Builder pattern.
Builder (abstract interface), ConcreteBuilder, Director (controls the construction sequence), and Product.
When is Builder preferred over a telescoping constructor?
When an object has many optional parameters or requires a step-by-step construction process, Builder avoids constructors with long confusing parameter lists and produces immutable, validated objects.
What is the intent of the Prototype pattern?
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying (cloning) this prototype.
What is the difference between a shallow copy and a deep copy in the context of Prototype?
A shallow copy duplicates the object's fields but shares referenced sub-objects; a deep copy recursively clones referenced sub-objects so the clone is fully independent.
Which creational pattern is most useful when object creation is costly and you want to avoid building from scratch?
Prototype, which creates new objects by cloning an existing configured instance rather than re-initializing from scratch.
What is the intent of the Adapter pattern?
Convert the interface of a class into another interface that clients expect, letting classes work together that otherwise couldn't due to incompatible interfaces.
What is the difference between a class adapter and an object adapter?
A class adapter uses multiple inheritance to adapt one interface to another; an object adapter uses composition, holding an instance of the adaptee and delegating calls to it.
What is the intent of the Bridge pattern?
Decouple an abstraction from its implementation so that the two can vary independently.
How does Bridge avoid a combinatorial explosion of subclasses?
By splitting the hierarchy into two independent dimensions (abstraction and implementation) joined by composition, so m abstractions and n implementations need m + n classes instead of m × n.
What is the key structural difference between Adapter and Bridge?
Adapter is applied after the fact to make unrelated existing interfaces work together; Bridge is designed up front to let abstraction and implementation vary independently.
Show the other 31 Design Pattern flashcards
What is the intent of the Composite pattern?
Compose objects into tree structures to represent part-whole hierarchies, letting clients treat individual objects and compositions of objects uniformly.
Name the three participant roles in the Composite pattern.
Component (common interface), Leaf (no children), and Composite (has children and implements child-management operations).
What is the intent of the Decorator pattern?
Attach additional responsibilities to an object dynamically, providing a flexible alternative to subclassing for extending functionality.
How does Decorator differ from simple subclassing for adding behavior?
Decorator adds behavior at runtime by wrapping an object and can be stacked in any combination, whereas subclassing fixes behavior at compile time and causes class explosion.
What structural property do Decorator, Adapter, Proxy, and Composite all share?
They are all wrapper-based structural patterns in which one object holds a reference to another and forwards/augments requests, conforming to a common interface (Decorator and Proxy keep the same interface).
What is the intent of the Facade pattern?
Provide a unified, higher-level interface to a set of interfaces in a subsystem, making the subsystem easier to use.
How does Facade differ from Adapter?
Facade defines a new simplified interface over a whole complex subsystem; Adapter makes one existing interface conform to another expected interface without simplifying the subsystem.
What is the intent of the Flyweight pattern?
Use sharing to support large numbers of fine-grained objects efficiently by sharing common state among them.
In Flyweight, distinguish intrinsic state from extrinsic state.
Intrinsic state is shared, context-independent data stored inside the flyweight; extrinsic state is context-dependent data supplied by the client and passed in on each operation (not stored).
Which pattern would you use to reduce memory when rendering thousands of tree objects that share the same texture and mesh?
Flyweight, storing the shared texture/mesh as intrinsic state and passing per-tree position/scale as extrinsic state.
What is the intent of the Proxy pattern?
Provide a surrogate or placeholder for another object to control access to it.
Name four common variants of the Proxy pattern.
Virtual proxy (lazy creation of expensive objects), remote proxy (represents an object in another address space), protection proxy (controls access rights), and smart reference/smart proxy (adds actions like reference counting or locking).
How do Proxy and Decorator differ in intent despite similar structure?
Both wrap an object with the same interface, but Proxy controls access to the object (often managing its lifetime/location), while Decorator adds new responsibilities/behavior.
What is the intent of the Chain of Responsibility pattern?
Avoid coupling the sender of a request to its receiver by giving multiple objects a chance to handle the request, passing it along a chain until one handles it.
In Chain of Responsibility, what happens if no handler in the chain handles the request?
The request falls off the end of the chain unhandled (it may be ignored or trigger a default action); handling is not guaranteed.
What is the intent of the Command pattern?
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Name the participant roles in the Command pattern.
Command (interface with execute), ConcreteCommand, Receiver (does the work), Invoker (triggers the command), and Client (creates and configures commands).
Which method is typically added to a Command interface to support undo functionality?
An 'undo()' (or 'unexecute()') method that reverses the effect of the corresponding execute().
What is the intent of the Interpreter pattern?
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
In Interpreter, what is the distinction between a TerminalExpression and a NonterminalExpression?
A TerminalExpression implements interpretation for a leaf/atomic grammar symbol; a NonterminalExpression represents a grammar rule composed of other expressions and interprets by recursively invoking its children.
What is the intent of the Iterator pattern?
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
What is the difference between an internal (passive) and an external (active) iterator?
With an external iterator the client controls the iteration and explicitly requests the next element; with an internal iterator the iterator controls iteration and applies a supplied operation to each element itself.
What is the intent of the Mediator pattern?
Define an object that encapsulates how a set of objects interact, promoting loose coupling by keeping objects from referring to each other explicitly.
How does Mediator change the communication topology among colleague objects?
It converts a many-to-many web of direct references between colleagues into a hub-and-spoke (star) topology where all colleagues communicate only through the mediator.
What is the intent of the Memento pattern?
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
Name the three participants of the Memento pattern.
Originator (creates and restores from mementos), Memento (stores the originator's internal state), and Caretaker (keeps mementos but never inspects their contents).
In Memento, why must the Caretaker treat the memento as opaque?
To preserve encapsulation: only the Originator may read or modify the memento's stored state; the Caretaker just holds and returns it, never examining its internals.
Which behavioral pattern is the natural basis for implementing undo/redo history, and what role stores each snapshot?
The Memento pattern; the Caretaker stores a stack of Memento snapshots produced by the Originator, restoring one to undo.
Which two patterns are commonly combined so that each queued Command object can be undone by saving state in a Memento?
Command and Memento: the Command captures the Receiver's prior state in a Memento before executing, enabling undo.
Which single creational pattern is inherently limited to producing one instance, and which produces whole families of related objects?
Singleton produces exactly one instance; Abstract Factory produces families of related objects.
Give one concrete example use case each for Facade, Flyweight, and Chain of Responsibility.
Facade: a simple API wrapping a complex compiler/subsystem. Flyweight: sharing glyph objects in a text editor. Chain of Responsibility: an event-handling or middleware pipeline where each handler may process or pass the event on.
Design Pattern syllabus FAQ
What is in the Design Pattern syllabus?
The Design Pattern syllabus (Design Patterns) is split into 5 chapters: Creational Patterns, Structural Patterns, Behavioral Patterns, Concurrency Patterns and Architectural Patterns. Together they contain 39 topics.
How many chapters and topics are in the Design Pattern syllabus?
5 chapters and 39 topics. The largest chapter is Behavioral Patterns, with 11 topics.
Are there Design Pattern flashcards?
Yes — 51 question-and-answer flashcards, printed in full on this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.
Related Programming syllabuses
Roadmap to DevOps Engineering
Data Structure and Algorithm syllabusRoadmap to Data Structure and Algorithm
Python syllabusRoadmap to Python developer
Data Science syllabusRoadmap to Data Scientist
Java Programming syllabusRoadmap to Java Programming
Front-end Web Development syllabusRoadmap to Front-end web development
Machine Learning syllabusRoadmap to Machine Learning
C++ Programming syllabusRoadmap to learn C++ programming
C Programming syllabusRoadmap to learn C programming