Exploring the Service Factory Pattern

  • Paul B. Monday


The Service Factory pattern has its roots in classic object-oriented design patterns such as the Abstract Factory pattern from the Gang of Four’s book, Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, 1995). The idea is simple: You should isolate points of variability into contained, easily manageable blocks of code. For example, the P.T. Monday Coffee Company application can use one of several different bean suppliers to provide raw beans that it subsequently roasts and sends to customers. Deciding which supplier to use is a point of variability and should therefore be isolated to its own module of code. However, the interface to any supplier’s ordering Web Service should not be a point of variability and should adhere to a single interface. The code to interact with a service can therefore remain in the primary code path. The Service Factory pattern isolates the code for deciding which supplier’s Web Service to use. The Web Service pattern implementation returns an architecture adapter to the service that the factory decided on and allows the primary code path to continue without any customization.


Business Process Application Program Interface Coffee Bean Service Interface Business Object 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Additional Reading

  1. •.
  2. •.
  3. •.
    Carey, James; Carlson, Brent. Framework Process Patterns: Lessons Learned Developing Application Frameworks. Addison-Wesley, 2002Google Scholar
  4. •.
    Carey, James; Carlson, Brent; Graser, Tim. SanFrancisco Design Patterns: Blueprints for Business Software. Addison-Wesley, 2000Google Scholar
  5. •.
    Fowler, Martin et. al. Patterns of Enterprise Application Architecture. Addison-Wesley, 2002Google Scholar
  6. •.
    Gamma, Erich et. al. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995Google Scholar

Copyright information

© Paul B. Monday 2003

Authors and Affiliations

  • Paul B. Monday

There are no affiliations available

Personalised recommendations