Proxy in Java Notes
Proxy in Java Notes
3. Real-world Analogy
Imagine a celebrity who doesn't want to be contacted directly by
fans. A manager (proxy) handles communication. The fans contact
the manager, who decides whether to pass the message along.
Similarly, in programming, a proxy controls access to a resource.
4. Use Cases
• - Access control/security
• - Lazy initialization
• - Logging and auditing
• - Remote method invocation
• Disadvantages:
7. Summary
The Proxy pattern in Java is a powerful concept used to manage
access to objects. By using proxies, developers can introduce
additional behavior like logging, security checks, and lazy
loading without modifying the actual business logic.