Exam Flashcards

1
Q

What classification is the Bridge pattern?

A

Object Structural

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

What is the intent of the Bridge pattern?

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
3
Q

The Bridge pattern involves what 2 different hierarchies?

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

What are the 4 participants in the Bridge pattern?

A
  1. Abstraction
  2. RefinedAbstraction
  3. Implementor
  4. ConcreteImplementer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What else is the Bridge pattern known as?

A

Handle/Body

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

What does the abstraction class keep reference to in the Bridge pattern?

A

Object of type Implementor

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

What would instantiating an object using the Bridge pattern look like?

A

Abstraction name = new RefinedAbstraction(new ConcreteImplementor)

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

What are the collaborations for the Bridge pattern?

A

Abstraction forwards client requests to implementor

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

What classification is the Decorator pattern?

A

Object Structural

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

What is the intent of the Decorator pattern?

A

Attach additional responsibilities to an object dynamically. An alternative to subclassing

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

What else is the Decorator pattern known as?

A

Wrapper

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

What are the 4 participants of the Decorator pattern?

A
  1. Component
  2. ConcreteComponent
  3. Decorator
  4. ConcreteDecorator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the Decorator participant maintain reference to?

A

Component Object

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

What are the collaborations of the Decorator pattern?

A

Decorator forwards requests to its component object. It may optionally perform additional operations before and after forwarding requests.

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

What classification is the State pattern?

A

Object Behavioural

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

What is the intent of the State pattern?

A

Allow an object to alter its behaviour when its internal state changes. The object will appear to change its class.

17
Q

What else is the State pattern known as?

A

Objects for States, Finite State Machine

18
Q

What are the 3 participants of the State pattern?

A
  1. Context
  2. State
  3. ConcreteState
19
Q

What does the context class do in a State pattern?

A

Maintains an instance of a ConcreteState subclass and defines the interface for clients

20
Q

What 4 collaborations does the State pattern have?

A
  1. Context delegates state-specific requests to the current ConcreteState object
  2. Context can pass itself to the state object so the state can access the context
  3. Context is the interface for clients
  4. Context or ConcreteState can decide which state succeeds another
21
Q

What classification is the Mediator pattern?

A

Object Behavioural

22
Q

What is the intent of the Mediator pattern?

A

Define an object that encapsulates how a set of objects interact. Promotes loose coupling by keeping objects from referring to each other explicitly

23
Q

What 3 participants are in the Mediator pattern?

A
  1. Mediator
  2. ConcreteMediator
  3. Colleague
24
Q

What are the collaborations of the Mediator pattern?

A

Colleagues send and receive requests from the Mediator object. The Mediator routes these requests between colleagues

25
Q

What classification is the Memento pattern?

A

Object Behavioural

26
Q

What is the intent of the Memento pattern?

A

Without violating encapsulation, capture and externalize an object’s internal state so the object can be restored to this state later.

27
Q

What else is the Memento pattern known as?

A

Token

28
Q

What are the 3 participants of the Memento pattern?

A
  1. Memento
  2. Originator
  3. Caretaker
29
Q

What are the 2 collaborations for the Memento pattern?

A
  1. Caretaker requests a memento from an originator, holds it, then if needed passes it back to the originator
  2. Mementos are passive: only the originator that created a memento will assign or retrieve its state
30
Q

What classification is the Facade pattern?

A

Object Structural

31
Q

What is the intent of the Facade pattern?

A

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.

32
Q

What are the 2 participants of the Facade pattern?

A
  1. Facade
  2. Subsystem classes
33
Q

What classification is the Observer pattern?

A

Object Behavioural

34
Q

What is the intent of the Observer pattern?

A

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

35
Q

What else is the Observer pattern known as?

A

Dependents, Publish-Subscribe

36
Q

What are the 4 participants in the Observer pattern?

A
  1. Subject
  2. Observer
  3. ConcreteSubject
  4. ConcreteObserver