Patterns Flashcards

1
Q

List pattern examples in JDK

A

Builder, Factory method,
Prototype - Objects.clone()
Singleton - System
Adapter - Arrays.asList()

Chain of responsibility - logger
Iterator - Iterator
Ptroxy - reflection

Observer - listener

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

Facade

A

Structural
Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use

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

Proxy

A

Structural
Provide placeholder for another object to control access to it.

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

Decorator

A

Structural
attach additional responsibilities to an object dynamically
alternative to subclassing for extending functionality

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

Strategy

A

Define a family of algorithms, encapsulate each one, and make them interchangeable.
Strategy lets the algorithm vary independently from clients that use it.

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

Observer

A

Define a one-to-many dependency between objects so that when one object changes state,
all its dependents are notified and updated automatically.

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

Bridge

A

Decouple an abstraction from its implementation so that the two can vary independently.

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

Singleton

A

Ensure a class only has one instance, and provide a global point of access to it.

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

Flyweight

A

minimizes memory use by sharing as much data as possible with other similar objects

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

Builder

A

Separate the construction of a complex object from its representation
so that the same construction process can create different representations.

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