Understanding Proxies

Proxies are needed when it's inappropriate for two components to communicate directly. This can happen when the components shouldn't know where the others exist in a distributed system or when address information shouldn't be hard-coded into the components — even if the components are local to the same processor.

The proxy should be efficient in terms of execution time; it should be able to determine quickly which component should be accessed and identify its location. Notwithstanding the reasons not to connect the client and server directly, the connection through the proxy should be transparent to the client; the client shouldn't realize that it isn't talking directly with the server.

Proxies benefit their applications by decoupling clients from the locations of the servers that they use. Proxies also help you structure the components to separate the required client-server interaction from the housekeeping associated with the client's finding and referencing the location of a server.

Because the proxy solution is transparent to the client, however, it can be inefficient. The client must know the differences in costs between local and remote services, and use the proxied remote service only when appropriate.

images

Don't make the strategies for caching or loading on demand discussed in some of the variants too complex. Doing so will increase development and maintenance ...

Get Pattern-Oriented Software Architecture For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.