1 / 9

Proxy

Proxy. Proxy. Category Structural Intent Provide a surrogate or placeholder for another object to control access to it Also known as Surrogate. Proxy Pattern Motivation. Proxy Applicability. A remote proxy provides a local representative for an object in a different address space

karyn-glenn
Télécharger la présentation

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

  2. Proxy • Category • Structural • Intent • Provide a surrogate or placeholder for another object to control access to it • Also known as • Surrogate

  3. Proxy Pattern Motivation

  4. Proxy Applicability • A remote proxy provides a local representative for an object in a different address space • A virtual proxy creates expensive objects on demand • A protection proxy controls access to the original object, in order to enforce access rights • A smart reference is a replacement for a bare pointer that performs additional actions when an object is accessed

  5. Proxy Pattern Structure

  6. Proxy Pattern Participants • Proxy (ImageProxy) • maintains a reference that lets the proxy access the real subject • provides an interface identical to Subject’s so that a proxy can be substituted for the real subject • controls access to the real subject and may be responsible for creating and deleting it

  7. Proxy Participants (continued) • Subject (Graphic) • defines the common interface for RealSubject and Proxy so that a Proxy can be used anywhere a RealSubject is expected • RealSubject (Image) • defines the real object that the proxy represents

  8. Proxy Consequences • Consequences • A remote proxy can hide the fact that an object resides in a different address space • A virtual proxy can perform optimizations such as creating an object on demand • Both protection proxies and smart references allow additional housekeeping tasks when an object is accessed

More Related