Intent
Use a simple object to represent a complex one or provide a placeholder for another object to control access to it.
Where to use & benefits
- If creating an object is too expensive in time or memory.
- Postpone the creation until you need the actual object.
- Load a large image (time consuming).
- Load a remote object over network during peak periods.
- Access right is required to a complex system.
Structure

Participants
Proxy (IShapeDrawer)
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.
Subject (RectangleShape, CircleShape, TriangleShape)
defines the common interface for RealSubject and Proxy so that a Proxy can be used anywhere a RealSubject is expected.
RealSubject (ShapeGraphicsDrawer)
defines the real object that the proxy represents.
Example
In the demonstration application, the drawShape() request to the shape (Rectangle, Trinagle, Circle) object act as a proxy and the actual implementation is provided in the ShapeGraphicsDrawer class which draws the shape using graphics object.
Class Diagram
