The factory method pattern concerns defining an interface (or abstract class) method for creating dependency objects. This method is called a factory method. The class (or interface) that holds the factory method will be considered an abstract creator. The actual object creation process does not happen in the factory method directly.
The concrete creators (which implement the factory method) will decide which dependent class to instantiate. In short, the dependent object is decided at runtime. This process has been described in the following diagram:
The factory pattern's implementation is a four-step process: