From the course: Node.js: Design Patterns
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
The Proxy pattern - Node.js Tutorial
From the course: Node.js: Design Patterns
The Proxy pattern
- [Narrator] A proxy is an object that controls access to another object. For example, it is possible to call your top executive, the CEO of your company, directly and make an appointment with them. However, the CEO is very busy and in order for them to function efficiently, you would call their assistant and make an appointment with them instead. The assistant controls access to the CEO. You can think of them as the proxy for the CEO. They queue up appointments, prevent unnecessary appointments, and they even keep track of who met with the CEO. There are a number of reasons to use a proxy, but the main motivation from the design pattern has to do with expensive objects. Instead of working directly with an object that requires a lot of resources, you can work with a proxy, an object that has the exact same interface, but the proxy can delay instantiation of an expensive object and control requests made to that object. The gang of four defines the intent of a proxy as providing a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
The Adapter pattern2m 20s
-
(Locked)
Implementing an adapter6m 24s
-
(Locked)
The Proxy pattern2m 11s
-
(Locked)
Implementing a proxy5m 48s
-
(Locked)
The Composite pattern3m 12s
-
(Locked)
Implementing composites5m 59s
-
(Locked)
The Decorator pattern4m 3s
-
(Locked)
Implementing decorators4m 24s
-
(Locked)
-
-