What are the benefits of using Factory pattern?

What are the benefits of using Factory pattern?

Ninja Asked on 18th September 2018 in Design Pattern.
Add Comment
1 Answer(s)
Best answer

Benefits of Factory pattern are:

  1. Factory pattern creates objects without exposing the instantiation logic and refers to the newly created object through a common interface.
  2. Factory pattern removes the instantiation of actual implementation classes from client code, making it more robust, less coupled and easy to extend.
  3. 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.

Ninja Answered on 18th September 2018.
Add Comment