O'Reilly logo

Java Design Patterns: A tour of 23 gang of four design patterns in Java by Vaskaran Sarcar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 4

image

Proxy Patterns

GoF Definition: Provide a surrogate or placeholder for another object to control access to it.

Concept

We want to use a class which can perform as an interface to something else.

Real–Life Example

In a classroom, when one student is absent, during roll call, his best friend may try to mimic the student’s voice to try to keep his friend from being marked as absent.

Computer World Example

Consider an ATM implementation for a bank. Here we will find multiple proxy objects. Actual bank information will be stored in a remote server. We must remember that in the real programming world, the creation of multiple instances of a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required