11 Commits

Author SHA1 Message Date
Dominik Liebler
79f94ba501 cs Decorator 2013-09-11 16:18:40 +02:00
Dominik Liebler
21b904b7d5 Merge pull request #14 from Trismegiste/master
Major improvement
2013-07-01 16:21:57 +02:00
Grégoire Paris
623ad06330 fix tiny typo 2013-06-02 22:33:35 +02:00
Trismegiste
6b77eb71e6 spacing 2013-05-11 02:51:57 +02:00
Trismegiste
55017fb43f fix PSR-0 2013-05-11 02:50:05 +02:00
Trismegiste
cfa9014906 fixing namespace 2013-05-11 02:07:29 +02:00
Trismegiste
97096bc23f fixing the inheritance tree for decorator 2013-05-11 02:06:15 +02:00
Matt Iversen
b8381e5a60 Proper example of Decorator pattern
Previous example was simply implementing a strategy pattern.

A key problem is that WebService made clear that it did no actual output of its own - it handed it off to 'decorators'.

A decorator should always wrap a class that already has its own complete, self-contained functionality.

In this way, they only enhance / modify it. An instance that is non-decorated should work fully by itself.

Note the distinguishing difference between this and sub-classing - here the enhancement is added dynamically, at runtime, and to one instance.

With sub-classing, the enhancement is added at compile / parse time, and is applied to all instances / uses of the subclass.
2013-05-10 11:14:19 +02:00
Dave Hulbert
f207444307 Fix typo 2013-05-09 10:10:54 +02:00
Dominik Liebler
9127a92b27 Update master 2012-06-15 15:33:21 +03:00
Dominik Liebler
11d64bf50d added Decorator pattern 2011-08-26 19:29:16 +02:00