I am reading the book Head First Design Patterns from O'Reilly. Before explaining the Factory Method Pattern, they introduce a Simple Factory first.They are using the example of a pizzeria. In a first step they show the problem:Pizza orderPizza(string type) {  Pizza pizza;  if (type.equals(Pepperoni) { pizza = new PepperoniPizza(); }  else if (type.equals(Salmon) { pizza = new SalmonPizza(); }  // ... and so on  pizza.Prepare();  pizza.Bake();  pizza.Cut();  pizza.Pack();  return pizza;}The obvious problem is that you had to change Pizzeria whenever you add or remove a Pizza.Hence they introduce a Simple Factory Idiom first. They move the creating part into a class SimplePizzaFactory. Now you don't need to modify Pizzeria anymore when adding or removing a Pizza.Then they say that this approach isn't that good, when you have more than one pizzeria (in several towns).I don't really understand their reasoning. They give the following example code and then they say that each pizzeria wouldn't be using the procedure as implemented above but were using different methods in order to bake, cut and pack the pizza.BerlinPizzaFactory berlinFactory = new BerlinPizzaFactory();Pizzeria berlinPizzeria = new Pizzeria(berlinFactory);berlinPizza.Order(Pepperoni);Instead of using the Simple Factory, they suggest using the Factory Method Pattern.First, I don't see why the BerlinPizzeria is supposed to not using the procedure. It's still a Pizzeria and when you call Order, you're using the same procedure.My best guess is that they are implying that you are able to implement, let's say, a cafeteria (I'm deliberately using something entirely different to make my point) and use the factory (as it is independent of the pizzeria) and prepare the pizza in a way you want to.But even when using the Factory Method Pattern, nobody forces you to use the default procedure. It's even simpler to hide that you're doing it differently. Their code examples are given in Java and Java methods are virtual by default. So I would be able to implement BerlinPizzeria and override Order (or had to explicitly declare the method as final). The client, however, wouldn't notice that my BerlinPizzeria is doing things differently.In conclusion I don't see any significant difference between a Simple Factory and the Factory Method Pattern. The only advantage of the Factory Method Pattern I'm seeing is that you would save a few classes (namely, the 'outsourced' factories).So, what is really the disadvantages of a Simple Factory and why isn't is a good idea to 'outsource' the creating part?Or what is really the advantage of the Factory Method pattern and why is it a good idea to force the creating part being implemented in the subclass?
What are the disadvantages of a simple factory?
design patterns;factory method;factory