Abstract Factory Patterns
- This is a rarely used pattern. It exists only when you have factory patterns in the project.
- Abstract factory expands on the basic factory pattern.
- Abstract factory helps us to unite similar factory patterns classes into one unified interface. This leads to more simplified interface for the client.
Example:
Steps:
- We have common an Interface or Abstract class
- The concrete classes implement this interface or abstract class.
- Then a new factory class is created which takes care of object creation. A similar abstract factory class takes the decision of returning the asked factory object. This abstract class will be used by the client.
- The client calls the static class object in above by creating an abstract class instead of the factory classes, as follows:
0 Comments