Describe the Factory method pattern

Experience Level: Senior
Tags: Design PatternsGang of Four (GoF)

Answer

Good to know

  • Factory Method Pattern is not the same as (static) factory method.

What poblems does Factory method pattern solve?

  • Defines an interface for creating an object but lets subclasses decide which product class to instantiate.

  • Factory method lets a class to defer instantiation to subclasses.

Other information

  • It's a creational pattern
  • It was defined by Gang of Four (GoF)
Related Design Patterns job interview questions

Comments

No Comments Yet.
Be the first to tell us what you think.