Tuesday

Factory pattern: https://www.tutorialspoint.com/design_pattern/factory_pattern.htm

Implement the factory pattern in CoffeCollective such that:

  • Instead of the menu directly instantiates an Americano, Espresso or Tea, the responsibility to create new objects are assigned to an Abstract Factory

  • Instead of the menu directly instantiates a Baguette or Croissant, the responsibility to create new objects are assigned to an Abstract Factory

(Advanced optional)

  • Configure the abstract factories such that it reads prices from a file

  • In this way - a Coffee Collective administrator can make changes in prices without changing the source code

Last updated

Was this helpful?