Factory Model:
Problem when instantiating new classes: "If the code that creates objects is distributed throughout your application, you have the same problem when adding new types-you must still chase down all the points of your code where type matters". Thus, it constantly results in rummaging code which ougth to be prevented.
Instead of instantiating an object every single time we use a pre-defined static method which is simply returning the object. This method bears a parameter which is then leading to the correct object output.
Why not simply instantiate it? Because it's too complex.
Correct ChairFactory-Output. Depends on whether you choose the BigChair, MediumChair or SmallChair. "To disallow direct access to the classes, you can nest the classes within the factory method, like this:"
Below are all the outputs.
A practical example of our project: