What are the benefits of using Factory pattern?
Answered
What are the benefits of using Factory pattern?
Best answer
Benefits of Factory pattern are:
- Factory pattern creates objects without exposing the instantiation logic and refers to the newly created object through a common interface.
- Factory pattern removes the instantiation of actual implementation classes from client code, making it more robust, less coupled and easy to extend.
- Factory pattern provides abstraction between implementation and client classes through inheritance.
Factory pattern is most suitable where there is some complex object creation steps are involved.