Factory

A factory creates objects.

One factory creates objects of one type only.

More than one factory can create objects of the same type, but with different implementations.

examples:

  • a date factory can create any date like 1879.1.1, 1900.12.31, ...

  • a coffee_machine factory creates objects of type coffee_machine

  • Ford, Toyota and Audi are factories which create objects of type car, with a common set of features (color, model, accelerate, slow_down, motor_failure, ...), but with different implementations and performances.

For more information about factories: see the section called “Factory”