design pattern question - proxy RRS feed

  • Question

  • Hello,

    I'm implementing a software module and hesitating about the appropriate design. The client needs to perform operations for an componenet which is divided to few parts in the memory. However the client treats the componenet as one contiguous.

    My design includes a "Manager" which has an interface for the client and handles all operations for this components. The "Manager" knows when it is asked to read/write the appropriate part of the memory. It hides the fact that the component is divided to few parts in the memory space.

    I wonder if this is called a proxy, facade or a bridge? Or maybe other pattern? I think it is a proxy but not sure since there few real objects (i.e. subjects) and not only one.

    In case this is a proxy - must I use also the "subject" or can the client use the proxy object directly? I don't see the point to "subject" and it will just cause to more unnecessary files and code.


    Thanks in advance,


    Friday, February 16, 2007 11:24 PM

All replies

  • the main difference between a Proxy and a Facade: a Proxy adds functionality a Facade doesn't... it's not a Bridge Pattern, a Bridge separates the interface from the implementation. take a look at: http://www.dofactory.com/Patterns/Patterns.aspx

    Saturday, February 17, 2007 8:23 AM
  • Sorry I would have to disagree that a proxy 'adds' functionality, it does not, generally it provides an interface to an instance of a set of functionality.

    A common example of a proxy is the 'proxy' class generated when you add a reference to a web service in Visual Studio. The application interacts with the proxy class not with the web service directly, the proxy class is responsable for the communications with the web service.

    A facade pattern provides a simplified interface to a set of components.

    A common example of a facade is a web service, often they are used to expose complicated business logic behind a public interface. Typically people create business logic to perform a task and then wrap this in a web service to expose this to other interested parties.


    Ollie Riches


    Saturday, February 17, 2007 1:22 PM
  • I agree with Ollie Riches.

    The proxy does not offer any functionality, it presents the same interface as the real domain object behind, and conveys the calls to that object. it is mainly used in order to provide access control or behind the scenes plumbing to load and call the underlying domain object or to restrict the acces to that object to some users satisfying certain criteria.
    While facade is a thin layer to facilitate the call or use of some functionality that is otherwide need the invocation of several components or classes. facade is usually utilized for recurring functionalities that are used frequently.

    Sunday, February 18, 2007 1:07 PM
  • 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.
  • I call that adding functionality

Wednesday, February 21, 2007 11:00 AM
  • To me the examples you describe above do not add functionality to the domain object being used, they are merely infrastructure, performance and security issues that are being addressed in the proxy - they don't add\alter the business logic defined in the domain object.

    Thats my 2 pennies worth...

    Ollie Riches



    Saturday, February 24, 2007 7:03 PM
  • I too agree that proxies do not add functionality but abstract the location of actual instance from local client but redirecting the requests.

    vikas goyal

    Monday, February 26, 2007 11:03 AM