0
0
LLDsystem_design~5 mins

Proxy pattern in LLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ADuplicates the real object to improve performance
BControls user permissions to access an object
CCreates expensive objects only when they are needed
DRepresents an object located on a remote server
What is the main purpose of a Protection Proxy?
ATo control access rights to the real object
BTo create objects lazily
CTo cache results for faster access
DTo represent remote objects
In the Proxy pattern, the proxy object must have the same ______ as the real subject.
Amemory size
Binterface
Cimplementation
Dlocation
Which proxy type is used to represent an object in a different address space or machine?
AVirtual Proxy
BSmart Proxy
CProtection Proxy
DRemote Proxy
What benefit does the Proxy pattern provide in system design?
AIt adds control and extra behavior without changing the real object
BIt hides the real object completely
CIt duplicates objects to improve speed
DIt removes the need for interfaces
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.