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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to