Re: Decorator classes
| From: | Marco Pivetta | Date: | Thu, 29 Dec 2016 14:43:49 +0000 |
| Subject: | Re: Decorator classes | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97486@lists.php.net to get a copy of this message | ||
On Thu, Dec 29, 2016 at 3:27 PM, Mathieu Rochette <mathieu@rochette.cc>
wrote:
> yeah it's mostly syntactic sugar, I think it would encourage developer to
> use this pattern instead of inheritance when appropriate.
> I also think that most of the time using the decorator pattern helps
> following the single responsibility principle
>
Meh, just
final as much as possible, combined with interfaces :-)
> also, this would add one more benefit : methods that are not override
> could probably be optimized by the PHP engine (avoid one userland proxy
> call)
>
That's probably something that opcache could do anyway.
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/