I'm going over some design pattern questions and I looked at the definition and examples of the Decorator Pattern in GoF. It says
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
It gives examples of Decorators which use inheritance which is definitely not dynamic, however.
NetObjectives commits the same error:
http://www.netobjectives.com/PatternRepository/index.php?title=TheDecoratorPattern
The Portland Pattern Repository discussion of the Decorator indicates that there is confusion about what is and is not a decorator
http://c2.com/cgi/wiki?DecoratorPattern
Wikipedia makes some sense of this contradiction by noting that the delegate inside the Decorator should be set at construction time (other DI techniques would also work)
http://en.wikipedia.org/wiki/Decorator_pattern
All examples of the Decorator pattern (in Java or C++) require a static construct either through inheritance or by implementing an interface. The explanation in GoF says that the additional responsibilities are attached dynamically, however. But this is simply wrong.
The comments at PPR talk about dynamic languages that can add methods at runtime, but Java and C++ aren't dynamic and the explanation of Decorator does not say it is limited to dynamic languages like Groovy and Lisp.
Wouldn't a correct explanation of Decorator say that in languages that don't support dynamic method creation both static and dyanmic constructs are involved?
GoF's explanation is simply wrong as shown by their own examples, or have I misunderstood something?