What are the different types of Proxy?
Answer
The GoF Proxy pattern has several common variants. A Virtual Proxy delays the creation of an expensive object until it is actually needed (lazy initialization) — a high-resolution image thumbnail is a virtual proxy for the full image. A Protection Proxy controls access to the real object, checking permissions before forwarding calls — useful for role-based access control. A Remote Proxy provides a local representative for an object in a different address space or machine — RMI stubs in Java are remote proxies. A Caching Proxy stores results of expensive operations and returns cached results for repeated requests. A Logging Proxy records method calls and arguments for auditing.
Previous
What is the difference between Strategy and Template Method?
Next
How does the Command pattern support undo/redo?
More Design Patterns (Gang of Four) Questions
View all →- Intermediate What is the Template Method design pattern?
- Intermediate What is the Visitor design pattern?
- Intermediate What is the difference between Factory Method and Abstract Factory?
- Intermediate When should you NOT use design patterns?
- Intermediate How are the Gang of Four patterns categorized?