Proxy Design Pattern Overview

proxy pattern n.w
1 / 23
Embed
Share

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.

  • Design Pattern
  • Proxy Pattern
  • Virtual Proxy
  • Access Control
  • Remote Proxy

Uploaded on | 0 Views


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


  1. Proxy Pattern presented by Ting Lu & Xinfu Lu

  2. Part 1 2 Problem ProblemContext Context

  3. Whats the Design Problem? 3

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

  5. Benefit Defer the full cost of its creation and initialization until we actually need to use it

  6. Suppose we just got the 2018 Mclaren 6

  7. Then the kid nextdoor climbed onto the car 7

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

  9. Whats the Design Problem? 9

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

  11. Recap #1 VirtualProxy #2 ProtectionProxy #3 Remote Proxy We llillustrate thefirst twohere

  12. Part 2 12 Description Descriptionof of Example Example

  13. Definition & Intent Byprovidinga surrogate or placeholder surrogate or placeholder class classfor the object tohave havecontrol access to control access to the theobject object

  14. UML Instead of load RealSubject, the Client will interact with Proxy, and request() is handled by Proxy. 14

  15. Our example REGIS System Application 15

  16. CourseList Loading - #1 Virtual Proxy REGIS (Client) wants to show a list from database, CourseListProxy (Proxy) then display() 16

  17. Admin Access Check - #2 Protection Proxy 17

  18. Part 3 18 Implementation Implementation in inPython Python

  19. CourseList Loading - #1 Virtual Proxy REGIS (Client) wants to show a list from database, CourseListProxy (Proxy) then display() 19

  20. Admin Access Check - #2 Protection Proxy 20

  21. Summary #1 VirtualProxy #2ProtectionProxy #3 Remote Proxy 21

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

  23. THANKS! Any questions? Any questions? 23

Related


More Related Content