Thanks Brion,
Well, the obvious limitation here is that you're
instantiating the
object with a fixed class first. This method means you'd have to either
proxy the original object or throw it away and create a new one (hope
there's no side effects!)
How do you feel about this alternative? (continuing the UploadForm example):
function instantiate( &$request ) {
$uploadForm = NULL;
wfRunHooks('BeforeInstantiate_UploadForm', array( &$uploadForm,
&$request ));
if ($uploadForm != NULL) {
return $uploadForm;
}
$uploadForm = new UploadForm($request);
wfRunHooks('AfterInstantiate_UploadForm', array( &$uploadForm,
&$request
));
return $uploadForm;
}
Subclassing could be a nice way to do things in
various circumstances,
where proxy objects are IMHO kind of ugly.
I also like the idea of Subclassing. Could you expand on what you mean by
proxy objects in this context? Perhaps with an example?
Note that we use factory methods fairly extensively,
usually with
multiple such methods.
Right right - such as "Title::newFromDBkey()", which in turn calls "new
Title()" internally. By replacing this internal call with another factory
method such as "Title::instantiate()", we still give extension devs a chance
to hijack it.
Thanks again for the feedback - I really appreciate your comments.
At the current time there is a class of problems that can only be solved by
hacking the source - as used to be the case for Semantic MW. Of course,
increasing the volume of wfRunHooks calls will help to reduce the problem
space (as was the case for Semantic).
As people want to do more with MW as a development platform, the number of
use-cases increases, and I hope we can find a way to blow the API wide open
to make nearly any modification possible, without resorting to hacking the
core code.
Thanks again,
Jim
On 2/14/07, Brion Vibber <brion(a)pobox.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jim Wilson wrote:
Gotcha - so when's the submission deadline
for patches to 1.10.0?
1.10 will branch from trunk in the first week of April per our quarterly
release cycle.
- -- brion vibber (brion @
pobox.com / brion @
wikimedia.org)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFF00nwwRnhpk1wk44RAnZ6AJ0aMeWYHO0hJ/dbM+PTL1wzqnXgkgCgvBeZ
x2dU8UXm1IK2ZxDbsXvpX8M=
=KSM7
-----END PGP SIGNATURE-----
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/wikitech-l