Member-only story
LLD: Proxy Design Pattern (Structural)
Definition
The Proxy Design Pattern provides a representative or placeholder for another object(real complex object) to control access to it.
Use cases of the Proxy Pattern
- Access Control: Restricts access to sensitive operations based on user permissions.
- Performance Optimization: Delays resource-intensive operations like expensive object creation until necessary (lazy loading).
- Pre/post processing: Performs additional operations before and after forwarding the request to the actual object, like adding cross-cutting concerns like audit traces (logging & monitoring), without modifying core business logic.
- Caching: Can cache results to improve performance.
Class Diagram
- Subject Interface (
EmployeeDao)
- Defines the common interface for both
EmployeeDaoImplandEmployeeDaoProxy. - Ensures the proxy can be used anywhere the real object is expected
2. Real Subject (EmployeeDaoImpl)
- Contains the actual…









