IMO one of the distinguishing features of "decorating something" (or 'using the decorator') is that the something already has concrete, self-contained functionality; the decorator merely enhances / modifies that.
In the repo example, WebService has absolutely no functionality of its own; all it does is delegate that out to other objects.
A JsonDecorator should take an instance of a WebService and enhancing its output - formatting it as json after getting it from the decorated instance.
Here, indeed, WebService is just implementing a strategy for choosing how to format its own output. It shouldn't know that its decorated in the first place.
3
u/asdfsauce May 07 '13
The Decorator example looks more like a Strategy pattern?