Mock tests, Interview questions, Tutorials and Tech news
 
 
Home > Programming / tutorials > Difference between Factory and Abstract Factory

Difference between Factory and Abstract Factory

September 14th, 2009 Vinay Leave a comment Go to comments

Abstract Factory: This is a Creational pattern.
It provides an interface for creating families of related or dependent objects (products) without specifying their concrete classes.
J2EE technology uses this pattern for the EJB Home interface, which creates new EJB objects.
It isolates concrete classes.
It makes exchanging product families easy.
It promotes consistency among products.
Supporting new kinds of products is difficult

Factory Method : This pattern defines an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
J2EE technology uses this pattern for the EJB Home interface, which creates new EJB objects.
Eliminates the need to bind application-specific classes into your code.
Gives subclasses a hook for providing an extended version of an object being constructed.

Difference between Factory and Abstract Factory
The Factory Method pattern is for creating a single object type. It provides a generic interface for client objects, and defers instantiation to subclasses that implement the generic interface.

The Abstract Factory pattern is for creating multiple, related objects, and defers instantiation to subclasses that implement the generic interface of the factory object

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • IndianPad
  • Reddit
Categories: Programming / tutorials Tags: ,
  1. No comments yet.
  1. No trackbacks yet.
Get Adobe Flash playerPlugin by wpburn.com wordpress themes