Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the basic difference between the Factory and Abstract Factory Design Patterns? [closed]

What is the basic difference between the Factory and Abstract Factory Patterns?

like image 678
user366312 Avatar asked Jun 16 '09 14:06

user366312


People also ask

What is the difference between factory and Abstract Factory design patterns?

The main difference between factory pattern and abstract factory pattern is that the factory pattern provides a method of creating objects without specifying the exact class used to create it while the abstract factory pattern provides a method to combine a group of individual factories without specifying their ...

Why would a factory method design pattern be a more appropriate design than an Abstract Factory design pattern?

The idea behind the Factory Method pattern is that it allows for the case where a client doesn't know what concrete classes it will be required to create at runtime, but just wants to get a class that will do the job while Abstract Factory pattern is best utilized when your system has to create multiple families of ...

What are the differences between factory method and prototype design patterns?

Factory pattern is used to introduce loose coupling between objects as the factory will take care of all the instantiation logic hiding it from the clients. Prototype pattern on the other hand is used when the cost of creating an object is large and it is ok to copy an existing instance than creating a new instance.

What is the difference between factory pattern and facade pattern?

The facade pattern is used when you want to hide an implementation or it is about changing interface of some class or set of classes. Builder hides the process of construction by decomposing it in smaller steps. Abstract factory pattern is used when you want to hide the details on constructing instances.


1 Answers

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

With the Abstract Factory pattern, you provide a way for anyone to provide their own factory. This allows your warehouse to be either an IFruitFactory or an IJuiceFactory, without requiring your warehouse to know anything about fruits or juices.

like image 66
John Feminella Avatar answered Oct 01 '22 10:10

John Feminella