Skip to main content

Proxy Pattern

Learn Proxy Pattern (Structural Patterns, Design Patterns in Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Proxy Pattern provides a placeholder/surrogate object that controls access to another (often expensive or remote) object - the proxy implements the same interface, so the client can't tell the difference. Real-Life Example: A credit card is a proxy for your bank account - it controls and checks access before money moves A security guard checking ID before letting someone into a building (access control proxy) Lazy-loading a huge image - a lightweight proxy stands in until the real image is actually needed Why do we need Proxy?

More lessons in Structural Patterns