Abstract factory design pattern is a part of creational design pattern, that lets you produce the family of related object, without specifying their concrete classes.
What does it mean by family of related Object ?
Family of related product can be Plates, Spoons and Bowl which is related to same family Kitchen Utensils and Steel, Fiber and Glass these are their varients.
Now lets suppose, you have an application where you are selling all these kind of products and its varients.
You have Plates in Steel, Fiber and Glass, and same for Spoon and Bowl.
Problem 😦
——————
Lets suppose , a customer ordered a Fiber Plate for his/her kitchen, after that they thought they need spoon and bowl as well. Now, what happen if you deliver Steel/Glass spoon and bowl. As these are not matching with Fiber plates and looks odd, customer gets frustrated.
So you need to create individual Kitchen Utensils Objects so that they match other objects of the same family. Customers get quite mad when they don’t receive matching Kitchen Utensils.
Solutions 🙂
The first thing the Abstract Factory pattern suggests is to explicitly declare interfaces for each distinct product of the product family (e.g., Plate,Spoon or Bowl). Then you can make all variants of products follow those interfaces. For example, all Plate variants can implement the Plate interface; all Spoon variants can implement the Spoon interface, and so on..