The Good Stuff Flashcards

1
Q

What are the best Creational Patterns?

A

Builder and Object Pool patterns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the best Structural Patterns?

A

Adapter, Bridge, Composite, Decorator, and Flyweight.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the best Behavioral Patterns?

A

Mediator, State, Visitor, Iterator,

Command, Interpreter, Chain of Responsibility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the framework design patterns?

A

Composite, Command, Interpreter, Chain of Responsibility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is a builder pattern helpful?

A

provides a single object whose API builds and returns an object Hierarchy to us.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why is an Adapter Pattern useful?

A

An Adapter / Wrapper helps when a class doesn’t offer the interface needed. The wrapper can have its methods called on the underlying object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is a Flyweight Pattern useful?

A

small read-only (immutable) data can be shared between object instances
Example the integers -5 to 256 in Python are flyweight objects. So each time a calculation returns an integer in that range, it’s the same object that gets returned each time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why is a Composite Pattern useful?

A

It gives all nodes in a hierarchy the same interface. We see this with graphic rendering such as the browser DOM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why is Chain of Responsibility Useful?

A

Behavior isn’t lost in a hierarchy. Just as in the browser an event isn’t lost when a child element is clicked on. The event “bubbles” up to the button element and ensure the click event occurs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is the Command Pattern useful?

A

It represents user actions as a list of objects that have a do() and undo() method. Which is super helpful in browsers and GUI frameworks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why is the Interpreter Pattern useful?

A

It’s like a suped up Abstract Syntax Tree, each node has an executable method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly