Requests document
Backend & Runtime / Knowledge library
Proxy Pattern
Places a stand-in that controls access to another object or service
Why learn Proxy Pattern?
It adds lazy loading, remote access, caching, or authorization transparently
The problem it solves
It mediates resource access without changing the client's interface
Where it came from
Proxy Pattern is a software design pattern that places a stand-in that controls access to another object or service. Its guarantees and tradeoffs depend on the concrete implementation and operating context.
Build your understanding
Work through these exercises in order. Try the task before opening a reference.
- Define Proxy Pattern and distinguish it from a neighboring concept.
- Choose a realistic task where Proxy Pattern is appropriate.
- Identify a failure mode caused by misusing Proxy Pattern.
- Interpret a small design or result involving Proxy Pattern.
- Explain one tradeoff or limitation of Proxy Pattern.
Documentation and sources
- Patterns of Enterprise Application Architecture (martinfowler.com)
Connect the ideas
Explore next
Real World Example
Secure Document Access Proxy
A legal firm managing sensitive client case files stored in a legacy document management system.
The business problem
Direct access to the legacy system is unauthenticated and resource-heavy, causing system instability when multiple associates query large document blobs simultaneously.
How this topic solves it
Implementing a Proxy pattern introduces a stand-in object that intercepts requests to the legacy system, enforcing authentication checks and managing connection pooling before delegating the call to the real service.
- Define a common interface shared by both the real document service and the proxy object.
- Implement the proxy class to hold a reference to the real service object.
- Add logic within the proxy to validate user credentials before forwarding requests.
- Incorporate lazy initialization or connection pooling within the proxy to manage resource consumption.
- Replace direct client calls to the legacy service with calls to the proxy instance.
This diagram shows how a client interacts with the proxy instead of the legacy system directly.
Validates access
Real data source
- Client → calls interface → Proxy
- Proxy → delegates request → Legacy System
Expected business outcome
Improved system stability and centralized security enforcement without modifying the underlying legacy document management codebase.
Limitations and checks
The proxy introduces an additional layer of indirection, which can increase latency for every request. To check for this, monitor the time difference between the proxy receiving a request and the real service completing the operation.