Tim Starling wrote:
Brion Vibber wrote:
Harris, Mike wrote:
$myTitle = new Title("Change Control Test");
You might want to look at the existing code for how title objects are created. There are factory functions for this.
I've been wondering for a while why the code above doesn't work. It looks much nicer than Title::newFromText(). Why can't we have sensible constructors for Title and User?
Of course, I'm the perpetrator of horrible entities such as Database::newFromParams(), but in my defence, I was just trying to fit in.
It probably would be reasonable, but we'd need to change some stuff. It doesn't work now. :)
One of the reasons we use static factory methods in various places is to provide semantically clear alternatives when there are mutliple different ways; for instance on Titles things get handled differently depending on whether the source text is from a URL or from wiki text. Or... something like that.
That one's a little confusing; others are clearer, eg taking an id number versus a name, or whatever.
-- brion vibber (brion @ pobox.com)