Sunday, February 9, 2020

Abstract Factory Design Pattern


Abstract factory design pattern is one of the creational patterns that deals with object creation mechanism, trying to create an object that suitable for the situation. It is also known as the “Factory of factories” because it will create multiple factories of main factory. Abstract factory design pattern is an abstract class for creating families of related object but without specify their concrete.
In abstract factory design pattern, system to be independent of how object created, composed and represented that means you don’t want to reveal to anything to client and client don’t have power to change inside the object. It will configure series of object at a time.
                                  


Fig above shows the basic flow chart of abstract factory design pattern. Abstract class is a abstract factory which will create different concrete factory. These concrete factory which will create related object. As you see in fig concrete class 1 create object_1(A) and object_1(B) but concrete class 2 create object_2(A) and object_2(B). So each concrete factory which will create different series of object but object in that they are same.

For example, suppose Book is an abstract factory and these Book abstract factory is divided into biography and novel concrete factory. Biography and Novel create Price_1, Author_1 and Price_2,Author_2 object respectively. So Biography and Novel will create different series of object but same object parameter.
Advantage of abstract factory design pattern:
It is easy to exchanging of object families.
Consistency among objects

Link of Blog: https://drive.google.com/a/vit.edu/file/d/1MXpQIERmESlt5DIbyOyj4O9KKYTU5dho/view?usp=drivesdk

10 comments:

Course Project: 3 Lane Car Game

Course Project Title:  3 lane car racing game Course Project Description:              The aim of our course project is to implement...