1 / 16

Lecture 39: When to Use A Proxy

Computer Science 313 – Advanced Programming Topics. Lecture 39: When to Use A Proxy. Why Do We Use Proxy Pattern?. Discussed word proxy in Wednesday's lecture When and why would we ever use a proxy?. Real-World Uses of Proxy. Real-World Uses of Proxy. Real-World Uses of Proxy.

dougal
Télécharger la présentation

Lecture 39: When to Use A Proxy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science 313 – Advanced Programming Topics Lecture 39:When to Use A Proxy

  2. Why Do We Use Proxy Pattern? • Discussed word proxy in Wednesday's lecture • When and why would we ever use a proxy?

  3. Real-World Uses of Proxy

  4. Real-World Uses of Proxy

  5. Real-World Uses of Proxy

  6. Real-World Uses of Proxy

  7. Why We Use Proxy • Add level of indirection before real subject • Continue actions, but protect subject from harm • Create plausible deniability – "But it wasn't me!" • Get tasks done, but eliminate need to be local • Improve performance by using saved results • Same design needs met using Proxy Pattern • In all cases, proxy appears identical to real subject • Proxy acts first then lets subject do the real work • Real subject stays hidden – client does not know

  8. Proxy versus… Adapter Proxy Pattern Adapter Pattern

  9. Proxy versus… Adapter Proxy Pattern Adapter Pattern • Client only knows of Proxy • Uses interface client needs • Subject does all work • Interface identical to the real subjects • Does not change each calls' parameters & return value • Cannot access real subject • Client only knows of Adapter • Uses interface client needs • Adaptee(s) does all work • Interface differs with that of adaptee(s) • Modifies, adds or removes parameters & return value • Can access real subject

  10. Proxy versus… Composite Proxy Pattern Composite Pattern

  11. Proxy versus… Composite Proxy Pattern Composite Pattern • Structural pattern • Common interface defined • One of GoF's patterns • Only one subject used • Proxy acts as a gatekeeper • Structural pattern • Common interface defined • One of GoF's patterns • Many leaves can be used • Composite collects leaves

  12. Proxy versus… Decorator Proxy Pattern Decorator Pattern

  13. Proxy versus… Decorator Proxy Pattern Decorator Pattern • Client thinks it has subject • Hides subject from others • Proxy can intercept call • One proxy per pattern • Does not add or modify basic functionality • Client thinks has concept • Hides concept from others • Decorator can intercept call • Many decorators per pattern • Adds or modifies concept's basic functionality

  14. Proxy versus… Observer Proxy Pattern Observer Pattern

  15. Proxy versus… Observer Proxy Pattern Observer Pattern

  16. For Next Class • Last lab due “Friday”; submit until final exam time • Start now == more committing acts involving carrots • Finish reading on our last design pattern • Lots of interesting code on Wednesday • Will be presenting many cool & useful hacks • Follow the white rabbit – they have tricks & carrots ----------censored----------

More Related