Factory Method: Creates an instance of several derived classes. Define
an interface for creating an object, but let subclasses decide which
class to instantiate. Factory Method lets a class defer instantiation to
subclasses.
In fact, this pattern is jut method, and this method producea object, so call factory method.
In previous, Creator is not good name for this class name, A better
name is Applicaiton. Because this Application just need this Product in
AnOperation(). Application’s main goal isn’t producing a object. You
need to know this.
Application(Creator in previous fig) want to use produce, But only
subclass know what kind of ConcreteProduct will be produced. Ok, The
main common points is a product will be produced, So I pull up this
common point and put it in base class, call it virtual FactoryMethod().
Then push down all change to subclass. It’s good idea ofpull upcommon and push down change