...

/

Factory Method: Benefits and Caveats

Factory Method: Benefits and Caveats

Compare the advantages and disadvantages of the Factory method pattern.

Benefits of using the Factory Method pattern

Why do we need to bother with different implementations of Target Object? Why can’t we just conditionally apply the functionality that this object encapsulates? Well, here’s why:

  • The Factory Method pattern enforces the single responsibility principle by separating conditional logic from the implementation of the logic inside
...