Proxy Design Pattern Tutorial

preview_player
Показать описание

Welcome 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.

Рекомендации по теме
Комментарии
Автор

2024 and still one of the best tutorial for design patterns.

miquelstrippoli
Автор

Thank you :) Don't worry I'll cover that in detail. I have a bunch of refactoring tutorials planned (that is the fancy name for what you're asking for) It is all coming. Sorry it takes so long, but I don't know any other way to do the tutorials the right way

derekbanas
Автор

I'm just very happy that you like them. This stuff translates perfectly into C# I'm sure. I'm glad you have benefited with you VB coding as well :)

derekbanas
Автор

almost 10 years later and these are still great!

ROSHing
Автор

Hey, the ATMProxy class constructs a new ATMMachine and returns its field values. How does this help if you need the values of fields from the realATMMachine?

aniketvp
Автор

I will have an exam this week and I have to know a lot of design Patterns, and your tutorials helped me a lot. Great tutorials. Thanks.

AdiMoldovan
Автор

I should have created code that took full advantage of the pattern, but I came up with this example to keep everything as simple as possible. I'll revisit patterns in the future and try to create better examples.

derekbanas
Автор

Hi Derek--- I understand the desire for simplicity. I was expected that proxy would have a composition relationship with the actual ATMMachine and the proxy would only expose the two methods. What are your thoughts?

coreycotton
Автор

I used bind a lot in part 3 of my JQuery tutorial and others after it. I didn't cover live or delegate though

derekbanas
Автор

Thank you :) I'm sorry, but I'm not sure what your question is. Feel free to send me a message in YouTube if you need more space to explain what is confusing. I'll do my best to help

derekbanas
Автор

I add comments and sometimes make minor changes if I think it will make the code easier to understand. The videos are normally improved, so if I can help the learning process with a few touch ups I do it. I hope that makes sense

derekbanas
Автор

Thank you so much for these beautiful videos. Financial help provides relief from problems temporarily but education provides relief from all problems forever. you are doing great service. Wish all universities provide free education

rajavardhanreddy
Автор

In the proxy class methods you use new() comando. Dosen't this just give you an new reference to an new object on an machine. in other words you always get start value of the machine?

Stefanfritzon
Автор

Hello, I definitely have tutorials on networking planned and I'll get to them ASAP

derekbanas
Автор

Hey Derek! Within your ATMProxy class, why do you instantiate a new ATMMachine on every method call? Wouldn't it be more efficient to have it as an instance variable and just access it within each method?

JShaker
Автор

Hi Derek, Great videos, thanks!
I have a question about the Proxy tutorial, i didn't actually understand
way in the ATMproxy class you creates a new ATMmachine object inside the methods,
It will provides you the same results anytime (for example cash=2000).

eranmaymony
Автор

I have a question. I understand that you created an interface (GetATMData) and you created the concrete classes (ATMMachine and ATMProxy) for that interface so why don't you use ATMMachine rather than ATMProxy. ATMMachine is still restricted by the interface when instantiated by the object realMachine. Example: you could do realMachine.getATMState() or atmProxy.geATMState().

Aerex
Автор

So wait i dont get it,
in order to create atm proxy we basically need to create real atm machine (inside the proxy)
now for that to happen it means the code needs to KNOW real atm class to begin with.
so if we can create atm proxy instance, we can create real atm machine instance in whatever code we work,
then we would simply access whatever we want from the real atm and simply ignore the proxy...
how is this really limiting someone? what forces someone to work only with the proxy? what prevents them from just creating real atm machine instance and using that, so what is exactly limiting this "outside program" from doing just that?

beepIL
Автор

if you use an object of interface type, which is apparantly doing the job of the proxy which is to limit access to methods, what is the use for the proxy object then?
great video by the way :-)

mo
Автор

These videos are timeless. Thank you for putting them up.

rne