0% found this document useful (0 votes)
34 views

Proxy Design Patterns

This document discusses two design patterns: the Proxy design pattern and the Decorator design pattern. The Proxy design pattern involves a Proxy class that maintains a reference to a RealSubject class and provides the same interface as the RealSubject so that it can be used interchangeably. There are different types of proxies such as remote proxies and protection proxies. The Decorator pattern involves a Component interface and ConcreteComponent classes that can have additional responsibilities dynamically added via Decorator and ConcreteDecorator classes.

Uploaded by

astrasri2011
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Proxy Design Patterns

This document discusses two design patterns: the Proxy design pattern and the Decorator design pattern. The Proxy design pattern involves a Proxy class that maintains a reference to a RealSubject class and provides the same interface as the RealSubject so that it can be used interchangeably. There are different types of proxies such as remote proxies and protection proxies. The Decorator pattern involves a Component interface and ConcreteComponent classes that can have additional responsibilities dynamically added via Decorator and ConcreteDecorator classes.

Uploaded by

astrasri2011
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Proxy design patterns: Also refer to 2008 paper soloutions!

participants

    The classes and/or objects participating in this pattern are:

 Proxy   (MathProxy)
o maintains a reference that lets the proxy access the real subject. Proxy may
refer to a Subject if the RealSubject and Subject interfaces are the same.
o provides an interface identical to Subject's so that a proxy can be substituted
for for the real subject.
o controls access to the real subject and may be responsible for creating and
deleting it.
o other responsibilites depend on the kind of proxy:
 remote proxies are responsible for encoding a request and its
arguments and for sending the encoded request to the real subject in a
different address space.
 virtual proxies may cache additional information about the real subject
so that they can postpone accessing it. For example, the ImageProxy
from the Motivation caches the real images's extent.
 protection proxies check that the caller has the access permissions
required to perform a request.
 Subject   (IMath)
o defines the common interface for RealSubject and Proxy so that a Proxy can
be used anywhere a RealSubject is expected.
 RealSubject   (Math)
o defines the real object that the proxy represents.
Decorator design pattern

participants

    The classes and/or objects participating in this pattern are:

 Component   (LibraryItem)
o defines the interface for objects that can have responsibilities added to them
dynamically.
 ConcreteComponent   (Book, Video)
o defines an object to which additional responsibilities can be attached.
 Decorator   (Decorator)
o maintains a reference to a Component object and defines an interface that
conforms to Component's interface.
 ConcreteDecorator   (Borrowable)
o adds responsibilities to the component.

You might also like