Re: [VOTE] Deprecate and remove calls from incompatible context (example of real usage that will break)
| From: | Patrick Schaaf | Date: | Tue, 29 Jan 2013 08:09:30 +0000 |
| Subject: | Re: [VOTE] Deprecate and remove calls from incompatible context (example of real usage that will break) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65323@lists.php.net to get a copy of this message | ||
On Monday 28 January 2013 21:46:27 Stas Malyshev wrote:
>
> I understand that there's a tendency to use OO as
> a neat way to namespace global functions and autoload them, but that's
> not how it is supposed to work.
I've seen that sentiment against using static methods several times now,
and it always falls short of mentioning the third ingredient it brings to the
table: inheritance.
In our internal development we often use static-method-only classes,
converting stuff previously required and global in that namespace-like-with-
autoload fashion, and most of the time this _additionally_ permits us to
refactor some conditional spaghetti mess into a small-set-of-subclasses
inheritance setup that makes the "fundamental" conditions stand out a lot more
clearly than sprinkling conditionals all over the place.
To my thinking, using just classes and static methods is absolutely fine OO,
simply considering each class to be a singleton object I do not need to
instantiate at all.
Regarding the discussion at hand (that $this thing) I wasn't even aware of the
old behaviour, and factoring common code in our small-set-of-subclasses
approach was the #1 reason to switch to PHP 5.4 some month ago, so that we
could use traits for that.
best regards
Patrick