This pattern was previously described in GoF95.


Let us consider the following code sample:

  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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.