The Factory pattern creates an item without exposing the creation logic. In this approach, an interface is used to create an object, but the subclass determines which class to instantiate.
Need to create different logger types like:
Need to create different report types like:
The UML class diagram above defines the following classes, interfaces, and objects:
The factory pattern is useful in the following situations: