Javascript Design Patterns #6 - Proxy Pattern

preview_player
Показать описание
What is a proxy object?
A proxy object is an object that acts as an interface (or placeholder) for something else. The proxy could be an interface to anything: an API, a network connection, a large object in memory, or some other resource that is expensive or impossible to duplicate.

A proxy is a 'stand-in' object that is used to access the 'real' object behind the scenes. In the proxy, extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object are invoked.

📚Materials/References:

🌎 Find Me Here:

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

Nice video. Just also want to mention that if you were to follow such a pattern, be aware that you need to check for outdated data, especially if you're working with data that changes a lot. One way to do that is to also attach a Date object to that specific data you're pulling in, and add some time limit for how long something will be stored in the proxy - which will be checked every time you try to fetch something via it.
If you want to do a lot of this, it's worth checking out Redis, a cache database.

RudeyTV
Автор

this video is my "Proxy" for Design Patterns!

neuodev
Автор

Thanks man this is crystal clear explanation

GopalSinghR
Автор

great, I like this teaching style, it would be nice to do patterns on TS

kirillpavlovskii
Автор

Nice and clear explanation. i hope your channel will grow up like thenewboston and traversymedia

zikrilariliusra
Автор

by far best explain for design patterns, I appreciate it, please make Adapter pattern video

hadibohluli
Автор

I wanna know about ES6 proxy instead of this. But thanks for making this video, this is a nice design pattern.

unicrix
Автор

Dude you're doing such a great work bro.
But can adjust that theme, it's too dark.
Otherwise I learned a lot.

Greetings from Tanzania 🇹🇿

raymondmichael
Автор

but now don't we have the problem of stale data? how to deal with that

pawandeore
Автор

I have question that we can also impliment features in main function then why we need proxy pattern

vasurangpariya
Автор

Thank you Sage. But why would you declare cache as an object, then use it as an Array? Why don't you declare cache as an array in the first place?

satlibwanzai
Автор

Thank you very much, but you haven't used Proxy keyword in the code. This is Proxy pattern or memoization pattern?

mahdiali
Автор

can you actaully use this example in the real world or would i need to set up a real cache? like setting up cookies? or is cache basically a proxy pattern itself?

js_programmer
Автор

Is this the pattern used for service workers?

theotherme
Автор

I think this is also reffered to as facade pattern

clingyking
Автор

but wait im confused....If you cashe the value, then the value will not update? so when the value changes on the other end you wont know?

tommyshaw
Автор

Looks like more as singleton pattern..

TheArmanist