1/24
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What are Design Patterns?
A software design pattern is a reusable, general solution to a common software design problem.
Why Use Design Patterns?
Design patterns provide standardized solutions to common problems, which reduces code duplication, improves maintainability, enhances scalability, and encourages flexibility and loose coupling. They also improve code readability and help isolate frequently changing parts of the system, improving encapsulation.
What are Creational Design Patterns?
Creational design patterns generalize the act of object creation, making it more flexible and decoupled from the application.
What is the Singleton pattern?
The Singleton pattern ensures that only one instance of a class exists.
What is the Factory Method pattern?
The Factory Method pattern delegates the creation of objects to subclasses.
What is the Abstract Factory pattern?
The Abstract Factory pattern creates families of related objects without specifying their concrete classes.
What is the Builder pattern?
The Builder pattern constructs complex objects step by step.
What is the Prototype pattern?
The Prototype pattern creates new objects by copying an existing object.
What are Structural Design Patterns?
Structural design patterns focus on class and object structure, ensuring that objects are combined efficiently.
What is the Adapter pattern?
The Adapter pattern allows incompatible interfaces to work together.
What is the Bridge pattern?
The Bridge pattern separates abstraction from implementation, providing flexibility.
What is the Composite pattern?
The Composite pattern treats individual and composite objects uniformly, allowing them to be handled similarly in a part-whole hierarchy.
What is the Decorator pattern?
The Decorator pattern dynamically adds behavior to an object without altering its structure.
What is the Facade pattern?
The Facade pattern provides a unified interface to simplify complex subsystems.
What is the Flyweight pattern?
The Flyweight pattern shares objects efficiently to reduce memory usage.
What is the Proxy pattern?
The Proxy pattern controls access to another object, often used for security or lazy initialization.
What are Behavioural Design Patterns?
Behavioural design patterns focus on communication between objects, defining how they interact and pass responsibility.
What is the Functor pattern?
The Functor pattern treats functions as objects, enabling function pointers to be replaced by function objects.
What is the need for Function Pointers and Functors?
Function pointers and functors allow varying how an operation is performed without changing the method implementing the algorithm, decoupling the application from its implementation.
What is the Iterator pattern?
The Iterator pattern provides a way to access elements of a collection sequentially without exposing the internal details of the data structure.
What is the difference between an Iterator and a for-each loop?
An Iterator provides explicit control over how the collection is traversed, while a for-each loop abstracts this process and is simpler to use.
What is the Iterable interface?
The Iterable interface allows an object to be used in a for-each loop, enabling traversal of the collection.
What is the Composite pattern used for?
The Composite pattern is used to create tree-like structures where individual objects and compositions of objects can be treated uniformly, useful for hierarchical data.
What are the key components of the Composite pattern?
The key components are Leaf objects (simple elements) and Composite objects (collections of components), both implementing the same interface.
What is the benefit of using the Composite pattern?
The Composite pattern simplifies the handling of hierarchical structures by allowing both individual objects and composites to be treated uniformly, improving flexibility and extensibility. \