Chapter 19

Controlling Access

In This Chapter

  • Seeing why proxies are useful
  • Recognizing different kinds of proxies
  • Adding a proxy to your system

In this chapter, I tell you how to isolate a component with a proxy — specifically, the Proxy pattern. You use this pattern when a client needs the services of another component and direct communication — even though possible — isn't the best solution. The proxy component provides an indirect way to access a component to coordinate, filter, and control direct access. This may be done to increase security, enforce protocols, or speed up operations, among other things that I cover in the “Getting Acquainted with Proxy Variants” section.

Many people, including Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, authors of Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley Professional) have written versions of the Proxy pattern. In this chapter, I discuss a general version of Proxy. You may encounter many variants that refine and adapt this general version.

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.