This pattern encapsulate object creation when create many instances according to different types. Such as : Pizza orderPizzal(String type){ Pizza pizza; if(type.equals(“cheese”)){ pizza = new CheesePizza(); }else if(………… ……………… these code will change in future, encapsulating these code into a class will diminish change effect.
Pizza orderPizzal(String type){
Pizza pizza = SimplePizzaFactory.createPizza(type);
……………