Decorator Design Pattern in Oracle PL/SQL: Using Object Type with Constructor
As I did with the Template Method Design Pattern I also tried to implement the "Decorator" Design Pattern in Oracle's PL/SQL language.
| English | Deutsch/German |
|---|---|
The Book "Head First - Design Patterns" perfectly describes the Decorator pattern.
So I wrote some Object Type to implement the Decorator. I'd like to have a DRINK class (Espresso or Tea) with just one attribute called "description" and a method which returns the price.
There are some specific classes to make instances like an Espresso. Other classes are "adding" sugar or cream to my espresso.
I'd like to receive following result:
-- start with a Espresso --
descr= Espresso
price= 1
descr= Espresso, sugar
price= 1,2
descr= Espresso, sugar, Cream
price= 1,95-- start with a Tea --
descr= Tea
price= 3
descr= Tea, sugar
price= 3,2
descr= Tea, sugar, Cream
price= 3,95















