Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the difference between factory and abstract factory pattern?

user-image
Question added by Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date Posted: 2013/10/25
Daanish Rumani
by Daanish Rumani , Product Manager , Publicis Sapient

The Factory pattern is applicable for a single class whereas AbstractFactory is for a set of classes. AbstractFactory uses the Factory pattern for each class in addition to defining a few other things.

ahmad mohammed
by ahmad mohammed , JAVA team lead , edu-tek

With the Factory pattern, you produce implementations (Apple, Banana, Cherry, etc.) of a particular interface -- say, IFruit.

With the Abstract Factory pattern, you produce implementations of a particular Factory interface -- e.g.,IFruitFactory. Each of those knows how to create different kinds of fruit.

More Questions Like This