Grasp and others

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:56 AM on 12/17/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

27 Terms

1
New cards

What is the purpose of Structural Patterns?

Define relationships between entities to form larger, flexible structures.

2
New cards

How does the Adapter Pattern help with legacy systems?

It allows incompatible interfaces to work together by converting one interface into another.

3
New cards

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.

4
New cards

Why is the Composite Pattern useful for managing hierarchies?

Organizes objects into a tree structure, treating single and group objects the same.

5
New cards

How does the Decorator Pattern add flexibility to Structural Patterns?

It dynamically adds new behaviors to an object without altering its structure, unlike inheritance.

6
New cards

What is the purpose of Behavioral Patterns?

Assign responsibilities between objects and define communication between them.

7
New cards

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.

8
New cards

When would you use the Observer Pattern?

It dynamically adds new behaviors to an object without altering its structure, unlike inheritance.

9
New cards

What is a drawback of the Observer Pattern?

Can cause performance issues if there are too many observers or frequent updates.

10
New cards

How does the State Pattern enable flexibility?

It allows an object to change its behavior when its internal state changes, avoiding complex conditionals.

11
New cards

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.

12
New cards

In which type of applications is the Flyweight Pattern most beneficial?

Applications with many similar objects, like simulations or dense UIs.

13
New cards

How do you avoid a God Object in the Flyweight Pattern?

Keep Flyweight focused on shared data and delegate unrelated tasks to other objects.

14
New cards

How does the Composite Pattern differ from the Decorator Pattern?

Composite manages object hierarchies; Decorator wraps single objects to add new behavior dynamically.

15
New cards

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

16
New cards

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.

17
New cards

How does the Strategy Pattern improve flexibility?

Organizes algorithms into separate classes and allows runtime selection of behavior.

18
New cards

What potential drawbacks can arise from using the Factory Method Pattern?

Can add complexity by introducing many subclasses.

19
New cards

When would you use the Builder Pattern instead of a Factory Method?

When constructing complex objects step-by-step with many optional components.

20
New cards

How does Polymorphism reduce the need for conditionals?

It delegates behavior variations to subclasses, avoiding if-else statements.

21
New cards

What is the purpose of using interfaces when designing systems?

Define boundaries between layers, promoting flexibility and decoupling dependencies.

22
New cards

Why is using new() problematic for dependencies?

Ties code to specific implementations, making it harder to test or manage changes.

23
New cards

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.

24
New cards

How can factories enable test-time injection?

Factories create mock or test versions of components for controlled testing.

25
New cards

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.

26
New cards

Why are interfaces critical for variance in design?

Allow different implementations without changing higher-level code.

27
New cards

How does the Factory Approach improve testability?

By injecting test objects instead of concrete implementations.