Final Review Flashcards

1
Q

What is the Proxy Object Structural Pattern?

A

AKA Surrogate, it is intended to provide a surrogate or placeholder for another object to control access to it. Typically used to defer full cost of creation and initialization until the object is actually needed.

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

What are the participants of a Proxy pattern and what do they do?

A

Proxy - maintains a reference to the real subject, provides a substitute interface, and controls access to the real subject.
Subject - Defines the common interface for RealSubject and Proxy so that a Proxy can be used anywhere a RealSubject is expected
RealSubject - Defines the real object that the proxy represents.

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

What is the Command Object Behavioral Pattern?

A

AKA Action/Transaction, the intent is to encapsulate a request as an object, letting you parameterize clients with different requests and support undoable operations.

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

Why should you use a Command Pattern?

A

Sometimes it’s necessary to issue requests to objects without knowing anything about the operation being requested or the receiver of the request.

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

When should you use a Command Pattern?

A

When you want to:
- parameterize objects by action
- specify, queue, and execute requests at different times
- support undo/logging
- structure a system around high-level operations built on primitive operations

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

What are the participants of a Command Pattern and what do they do?

A

Command- Declares an interface for executing an operation
ConcreteCommand - Defines a binding between a Receiver object and an action and implements Execute (invoked on Receiver)
Client - Creates a ConcreteCommand object and sets the receiver
Invoker - Asks the command to carry out the request
Receiver - Knows how to perform the operations associated with carrying out a request

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

When should you use a Proxy Pattern?

A

Whenever there is a need for a more versatile or sophisticated reference to an object than a simple pointer.

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

What is the Chain of Responsibility Object Behavioral Pattern?

A

A pattern with intent to avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.

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

When should you use a Chain of Responsibility Pattern?

A

Use when:
- more than one object may handle a request and the handler isn’t known beforehand
- you want to issue a request to one of several objects without explicitly specifying the receiver
- the set of objects that can handle a request should be specified dynamically

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

What are the participants of Chain of Responsibility?

A

Handler - Defines an interface for handling requests and may implement the successor link
ConcreteHandler - Handles requests it is responsible for
Client - Initiates the request to a ConcreteHandler

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

What is the Visitor Object Behavioral Pattern?

A

A pattern that intends to represent an operation to be performed on the elements of an object structure. Lets you define a new operation without changing the classes of the elements on which it operates.

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

When should you use the Visitor Pattern?

A

Use when:
- an object structure contains many classes of objects with differing interfaces and their operations depend on the concrete class
- many distinct and unrelated operations need to be performed on objects in an object structure
- the classes defining the object structure rarely change but you often want to define new operations over the structure

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

What are the participants of a Visitor pattern?

A

Visitor - declares a Visit operation for each ConcreteElement in the object structure
ConcreteVisitor - Implements each operation declared by Visitor
Element - defines an Accept operation that takes a visitor as an argument
ConcreteElement - implements an Accept operation that takes a visitor as an argument
ObjectStructure - can enumerate its elements

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

What is the MVC triad pattern?

A

It consists of a Model (app), View (screen presentation), and Controller (defines the way the UI reacts to user input) and decouples them to increase flexibility and reuse by establishing a subscribe/notify protocol between them.

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