November 2018
Intermediate to advanced
388 pages
9h 5m
English
To begin, we create four packages, each of which represents the components of the decorator pattern. These packages are named component, concretecomponent, decorator, and concretedecorator. This is shown in the following screenshot:

In our case, Window is our component. This is an interface that declares the getDescription() and getPrice() functions:
interface Window { fun getDescription(): String fun getPrice(): Double}
We have three implementations of the component—LargeWindow, MediumWindow, and SmallWindow. These implementations are similar and look like the following:
class LargeWindow : Window ...
Read now
Unlock full access