Recall & Review
beginner
What is the Proxy pattern in system design?
The Proxy pattern is a design pattern where a proxy object controls access to another object, called the real subject. It acts as a placeholder to add extra functionality like access control, lazy loading, or logging without changing the real object's code.
Click to reveal answer
intermediate
Name three common types of proxies used in system design.
1. Virtual Proxy: Creates expensive objects only when needed.<br>2. Protection Proxy: Controls access rights to the real object.<br>3. Remote Proxy: Represents an object in a different address space or machine.
Click to reveal answer
intermediate
How does a Proxy pattern improve system scalability?
By delaying expensive object creation (lazy loading) or controlling access, proxies reduce resource use and improve performance. For example, a virtual proxy creates objects only when needed, saving memory and CPU.
Click to reveal answer
beginner
In the Proxy pattern, what role does the proxy object play compared to the real subject?
The proxy object acts as a middleman. It has the same interface as the real subject and forwards requests to it. It can add extra behavior before or after forwarding, like checking permissions or caching results.
Click to reveal answer
beginner
Give a real-life analogy for the Proxy pattern.
Think of a receptionist (proxy) in an office who controls visitor access to the manager (real subject). The receptionist checks visitor credentials and only lets authorized people meet the manager, adding a layer of control.
Click to reveal answer
Which of the following best describes a Virtual Proxy?
✗ Incorrect
A Virtual Proxy delays the creation of expensive objects until they are actually needed.
What is the main purpose of a Protection Proxy?
✗ Incorrect
A Protection Proxy controls who can access the real object, enforcing security or permissions.
In the Proxy pattern, the proxy object must have the same ______ as the real subject.
✗ Incorrect
The proxy must implement the same interface so it can be used interchangeably with the real subject.
Which proxy type is used to represent an object in a different address space or machine?
✗ Incorrect
A Remote Proxy represents an object located remotely, handling communication details.
What benefit does the Proxy pattern provide in system design?
✗ Incorrect
The Proxy pattern adds control or extra behavior transparently without modifying the real object.
Explain the Proxy pattern and describe a scenario where it can be useful.
Think about how a middleman can help control or delay access.
You got /3 concepts.
List and explain the differences between Virtual Proxy, Protection Proxy, and Remote Proxy.
Focus on what each proxy controls or represents.
You got /3 concepts.