Proxy Design Pattern Tutorial

Proxy Design Pattern TutorialWelcome to my Proxy Design Pattern Tutorial! The Proxy design pattern limits access to just the methods you want made accessible in another class.

It can be used for security reasons, because an Object is intensive to create, or is accessed from a remote location. You can think of it as a gate keeper that blocks access to another Object. I demonstrate how the proxy pattern works using some code used in my State Design Pattern Tutorial. You may want to check that tutorial out before proceeding.

If you like videos like this, it helps to tell Google by clicking here [googleplusone]

Share it if you like [nttfblike]

Code from the Video

ATMMACHINE.JAVA

GETATMDATA.JAVA

ATMPROXY.JAVA

TESTATMMACHINE.JAVA

ATMState.java

25 thoughts on “Proxy Design Pattern Tutorial”

  1. Hi,
    Thanks for providing the best ever tutorial on design patterns.
    Do you have something in Java concurrency also?

    Regards.
    ashg

  2. Excellent site to learn Design Pattern.THanks a ton for your effort.

    Request you to kindly add some tutorials for Java Concurrency.

    Thanks

      1. Hi Derek,

        The code you provided here is incomplete. There are a lot of staff missing here, including some classes from your “State Design Pattern” code, where some classes should be refactored to suit “Proxy Design Pattern” needs.
        Thanks

      2. Just update, classes from “state dp” should be included, but not refactored. It’s “ATMMachine.java” class is incomplete

  3. Hello sir,

    I have seen almost all of your videos about design patterns. This help me a lot in polishing my java skills. And yes Of’cousre You have the Most innovative method of teaching. God Bless You. Keep Rocking !!

  4. Very well explained. Is there any way we can get access to the slide and UML diagram shown at the beginning of the video? This goes for all videos on design patterns.

  5. Hi Derek,

    I have a confusion. Does the methods in Proxy not return initial states of a fresh object all the time? Since, it is freshly allocated there and returned.

    Regards
    Abhinav

    1. Hi Abhinav,

      Yes you are correct. I dramatically simplified the ATM part here. I’m assuming that it would actually be connected to a database and that the ATM object would just provide already created and stored data. I should have made it clear in the tutorial that I wasn’t fully developing the ATM because I thought that would distract from the pattern. Sorry about that

  6. Awesome example and great explanation. Hats off to you for such nice tutorials on design patterns. Thank you so much. Please keep up the good work. God bless you.

Leave a Reply

Your email address will not be published. Required fields are marked *