
Proxy Design Pattern Overview
Learn about the Proxy design pattern presented by Ting Lu & Xinfu Lu, addressing design problems and solutions with Virtual Proxy, Protection Proxy, and Remote Proxy. Explore examples such as difficulties opening documents and access control issues, along with benefits and practical applications. Dive into the concept of deferring the full cost of object creation until needed and ensuring the right access for users. Gain insights into object interaction in different address spaces and how proxies can aid in these scenarios.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Proxy Pattern presented by Ting Lu & Xinfu Lu
Part 1 2 Problem ProblemContext Context
Whats the Design Problem? #1 Difficulties Opening Documents It takes forever to open a document with some graphical objects (e.g. very large images) But documents are supposed to open fast! Example: Large images/tables/etc. inside a document Solution: Virtual Proxy use a placeholder class that only loads the info when the object is needed (info saved beforehand) 4
Benefit Defer the full cost of its creation and initialization until we actually need to use it
Suppose we just got the 2018 Mclaren 6
Then the kid nextdoor climbed onto the car 7
Whats the Design Problem? #2 Access Control Make sure the right access is given to the right user Example: Driver age check; Admin/User access check Solution: Protection Proxy use a surrogate class to check whether the caller has sufficient access permissions to perform a request. 8
Whats the Design Problem? #3 Object resides in a different address space Need to interact with an object in a different address space Example: ATM machines, need to retrieve data from bank database; Webpages, need computer network to retrieve data from remote server Solution: Remote Proxy Uses a local class for an object in a different address space 10
Recap #1 VirtualProxy #2 ProtectionProxy #3 Remote Proxy We llillustrate thefirst twohere
Part 2 12 Description Descriptionof of Example Example
Definition & Intent Byprovidinga surrogate or placeholder surrogate or placeholder class classfor the object tohave havecontrol access to control access to the theobject object
UML Instead of load RealSubject, the Client will interact with Proxy, and request() is handled by Proxy. 14
Our example REGIS System Application 15
CourseList Loading - #1 Virtual Proxy REGIS (Client) wants to show a list from database, CourseListProxy (Proxy) then display() 16
Admin Access Check - #2 Protection Proxy 17
Part 3 18 Implementation Implementation in inPython Python
CourseList Loading - #1 Virtual Proxy REGIS (Client) wants to show a list from database, CourseListProxy (Proxy) then display() 19
Admin Access Check - #2 Protection Proxy 20
Summary #1 VirtualProxy #2ProtectionProxy #3 Remote Proxy 21
Proxy is applicable whenever there is a need for a more versatile or sophisticated versatile or sophisticated reference referenceto an object than a simple pointer a more 22
THANKS! Any questions? Any questions? 23