Object-Oriented Programming, unit: Design Patterns Basics. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.
38 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a design pattern?
Show answer
A general, reusable solution to a commonly occurring problem in software design
- What is the Singleton pattern?
Show answer
A pattern ensuring a class has only one instance and provides a global point of access to it
- What is the Factory pattern?
Show answer
A pattern that creates objects without specifying their exact class in the calling code
- What is the Observer pattern?
Show answer
A pattern where objects (observers) are notified automatically when a subject's state changes
- What is the Strategy pattern?
Show answer
A pattern that defines a family of interchangeable algorithms and selects one at runtime
- What is the Decorator pattern?
Show answer
A pattern that adds behavior to an object dynamically without altering its class
- What is the Adapter pattern?
Show answer
A pattern that allows incompatible interfaces to work together by wrapping one in another
- What is the Builder pattern?
Show answer
A pattern that separates complex object construction from its final representation
- What is the Model-View-Controller (MVC) pattern?
Show answer
A pattern separating an application into data (Model), display (View), and logic (Controller)
- Why are design patterns useful?
Show answer
They provide proven, well-understood solutions and a shared vocabulary among developers
- What is a creational design pattern?
Show answer
A pattern concerned with object creation mechanisms, like Singleton or Factory
- What is a structural design pattern?
Show answer
A pattern concerned with composing classes and objects into larger structures, like Adapter
- What is a behavioral design pattern?
Show answer
A pattern concerned with communication and responsibility between objects, like Observer
- What problem does the Singleton pattern risk introducing?
Show answer
Global state that can make testing and reasoning about code more difficult
- Who are the 'Gang of Four' (GoF)?
Show answer
The four authors (Gamma, Helm, Johnson, Vlissides) of the 1994 book that cataloged 23 classic design patterns.