Exam(2024) Flashcards
What classification is the Proxy pattern?
Object Structural
What else is the Proxy pattern known as?
Surrogate
What is the intent of the Proxy pattern?
Provide a placeholder for another object to control access to it
What is the motivation for using the Proxy pattern?
Defer full cost of its creation until we actually need to use it
What are the 4 types of proxies? (Retarded Village People Smell)
- Remote Proxy
- Virtual Proxy
- Protection Proxy
- Smart Reference
A smart pointer is an example of what kind of proxy?
Smart Reference
What kind of proxy creates an expensive object on demand?
Virtual Proxy
What are the 3 participants of the Proxy pattern?
- Proxy
- Subject
- RealSubject
How do the Proxy and the RealSubject interact?
Proxy forwards requests to RealSubject when appropriate
What is it called when the Proxy pattern defers copying a large and complicated object until ensuring there has been a change to the object?
copy-on-write
What classification is the Command pattern?
Object Behavioural
What is the intent of the Command pattern?
Encapsulate a request as an object
What else is the Command pattern known as?
Action, Transaction
What is the motivation for the Command pattern?
Allow an object to make requests to unknown or variable receivers by making the request an object
What are the 5 participants of the Commander pattern?
- Command
- ConcreteCommand
- Client
- Invoker
- Receiver
Which participant of the Commander pattern defines a binding between a Receiver object and an action?
ConcreteCommand
ConcreteCommand implements which function that invokes corresponding operations on Receiver?
Execute
What creates the ConcreteCommand and specifies its Receiver?
Client
What stores the ConcreteCommand object?
Invoker
What stores state for undoing a command when applicable?
ConcreteCommand
Command decouples the object that invokes the operation from what?
The object that knows how to perform it
What pattern can be used to combine many commands to create a MacroCommand class?
Composite