23 PROXY
This pattern was previously described in GoF95.
DESCRIPTION
Let us consider the following code sample:
//Client
class Customer{
public void someMethod(){
//Create the Service Provider Instance
FileUtil futilObj=new FileUtil();
//Access the Service
futilObj.writeToFile(“Some Data”);
}
}
As part of its implementation, the Customer class creates an instance of the FileUtil class and directly accesses its services. In other words, for a client object, the way of accessing a FileUtil object is fairly straightforward. From the implementation it seems to be the most commonly used way for a client object to access a service provider object. In contrast, sometimes a client object may not be able to access a service provider object (also referred ...
Get Software Architecture Design Patterns in Java 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.