1/26
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is the purpose of Structural Patterns?
Define relationships between entities to form larger, flexible structures.
How does the Adapter Pattern help with legacy systems?
It allows incompatible interfaces to work together by converting one interface into another.
When can the Proxy and Adapter patterns complement each other?
Both Proxy and Adapter wrap an object and forward requests, but Proxy controls access while Adapter converts interfaces for compatibility.
Why is the Composite Pattern useful for managing hierarchies?
Organizes objects into a tree structure, treating single and group objects the same.
How does the Decorator Pattern add flexibility to Structural Patterns?
It dynamically adds new behaviors to an object without altering its structure, unlike inheritance.
What is the purpose of Behavioral Patterns?
Assign responsibilities between objects and define communication between them.
How does the Chain of Responsibility differ from Strategy?
Chain passes a request through a chain of handlers; Strategy selects behavior (algorithm) at runtime from a family of options.
When would you use the Observer Pattern?
It dynamically adds new behaviors to an object without altering its structure, unlike inheritance.
What is a drawback of the Observer Pattern?
Can cause performance issues if there are too many observers or frequent updates.
How does the State Pattern enable flexibility?
It allows an object to change its behavior when its internal state changes, avoiding complex conditionals.
What is the main benefit of separating intrinsic and extrinsic state in the Flyweight Pattern?
It reduces memory usage by sharing intrinsic state among objects while allowing unique extrinsic state.
In which type of applications is the Flyweight Pattern most beneficial?
Applications with many similar objects, like simulations or dense UIs.
How do you avoid a God Object in the Flyweight Pattern?
Keep Flyweight focused on shared data and delegate unrelated tasks to other objects.
How does the Composite Pattern differ from the Decorator Pattern?
Composite manages object hierarchies; Decorator wraps single objects to add new behavior dynamically.
How do the Proxy and Decorator patterns overlap?
he Proxy and Decorator patterns overlap as both wrap an object and forward requests to the wrapped objct
What is the main purpose of the Singleton Pattern, and what are its disadvantages?
Purpose: Ensure one instance of a class exists; Disadvantage: Creates global state, harder to test and maintain.
How does the Strategy Pattern improve flexibility?
Organizes algorithms into separate classes and allows runtime selection of behavior.
What potential drawbacks can arise from using the Factory Method Pattern?
Can add complexity by introducing many subclasses.
When would you use the Builder Pattern instead of a Factory Method?
When constructing complex objects step-by-step with many optional components.
How does Polymorphism reduce the need for conditionals?
It delegates behavior variations to subclasses, avoiding if-else statements.
What is the purpose of using interfaces when designing systems?
Define boundaries between layers, promoting flexibility and decoupling dependencies.
Why is using new() problematic for dependencies?
Ties code to specific implementations, making it harder to test or manage changes.
What are the benefits of the Factory Approach?
The Factory Approach promotes loose coupling, centralizes object creation, enables code reuse, and allows adding new classes without changing existing client code.
How can factories enable test-time injection?
Factories create mock or test versions of components for controlled testing.
How does the Abstract Factory differ from the Factory Method?
The Abstract Factory creates families of related objects without specifying their concrete classes, while the Factory Method focuses on creating a single item delegating instantiation to subclasses.
Why are interfaces critical for variance in design?
Allow different implementations without changing higher-level code.
How does the Factory Approach improve testability?
By injecting test objects instead of concrete implementations.