Skip to content

Latest commit

 

History

History

decorator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Adding your choice of ingredients to your coffee

Problem

As a barista you want the ability to work with your ingredients when selling coffee. You want to have a modern serving method where you can add ingredients dynamically to the orders from your customers to be able to serve them the perfect coffee for their palate.

Exercise

Add to the current domain classes that will enable you to serve different kinds of coffee to your customers.

  • ColdMilk

  • WarmMilk

  • FrothedMilk

  • Caramel

  • Ice

Once you have created the classes above add specifications in the barista_spec.rb file and start serving coffee.

Intent (Decorator)

Sometimes we want to attach responsibilities to an object dynamically without subclassing or extending the behaviour of an existing object. With the decorator we can embellish an object by recursively wrapping it into other objects which share the same interface.