The Factory Method differs from the ordinary Simple Factory on the basis that instead of us having one factory, we can have many.
So why would you want to do this? Well, in order to understand this, we must look to the open/closed principle (OCP). Bertrand Meyer is usually associated with having originated the term open/closed principle in his book, Object-oriented Software Construction. Meyer stated the following:
"software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification"
Where a software entity needs to be extended, this should be possible without modifying its source code. Those of you who are familiar with the SOLID (single responsibility, open-closed, Liskov substitution, interfacesegregation and dependency inversion) principles of object-oriented software may already have heard of this principle.
The Factory Method allows you to group certain classes together and deal with them by means of an individual factory for...