OOP Design Patterns Flashcards
What are Design Patterns in OOP?
Design patterns are reusable solutions to common software design problems. They provide proven approaches to structure code and improve maintainability, flexibility, and reusability.
What are the different categories of Design Patterns?
Design patterns are typically categorized as Creational, Structural, and Behavioral. Creational patterns focus on object creation, Structural patterns on object composition, and Behavioral patterns on communication between objects.
What is the Singleton Pattern?
Ensures a class has only one instance and provides a global access point to it.
What is the Factory Method Pattern?
Creates objects without specifying the exact class to be instantiated.
What is the Abstract Factory Pattern?
Provides an interface for creating families of related objects.
What is the Builder Pattern?
Separates object construction from its representation, allowing step-by-step object creation.
What is the Prototype Pattern?
Creates new objects by cloning an existing object.
What is the Adapter Pattern?
Allows incompatible interfaces to work together by wrapping an object with an adapter interface.
What is the Proxy Pattern?
Provides a surrogate or placeholder for another object to control access or add additional functionality.
What is the Decorator Pattern?
Adds new functionality to an object dynamically without altering its structure.
What is the Facade Pattern?
Provides a simplified interface to a complex system or a set of classes.
What is the Composite Pattern?
Treats a group of objects as a single object, allowing for composing parts into a tree structure.
What is the Strategy Pattern?
Defines a family of algorithms, encapsulates each one, and makes them interchangeable.
What is the Observer Pattern?
Defines a one-to-many dependency between objects when one object changes state, all its dependents are notified.
What is the Command Pattern?
Encapsulates a request as an object, allowing for parameterizing clients with different requests, queuing or logging requests, and undo/redo functionality.