This chapter covers the Simple Factory pattern.
The Simple Factory pattern creates an object without exposing the instantiation logic to the client.
In object-oriented programming (OOP), a factory is such an object that can create other objects. A factory can be invoked in many ways, but most often, it uses a method that can return objects with varying prototypes. Any subroutine that helps create these new objects is considered a factory. Most importantly, it helps you abstract the process of object creation from the consumers of the application.