Hi, the above explanation is very nice.
However, I am slightly confused by the implementation of Decorator Pattern (DeP) as given in
The design for above linked code is given at tinypic.com/view.php?pic=xnaqlt&s=3
I am confused by "super.callTrailer();" in the decorator classes Header1, Header2, Footer1 and Footer2, all derived from TicketDecorator.
Shouldn't it be just "callTrailer();" ? As each decorator object would have its own reference to the next decorator due to the line "private Component myTrailer;".
Note: I am not very well versed in Java and a beginner in Design Patterns.