On 9/22/10 9:49 AM, Aryeh Gregor wrote:
Partly this is a matter of preference. I personally write things almost entirely for core -- I've never written an extension, so my only extension commits are to things that other people wrote as extensions. Other people prefer to write extensions instead of core features. As long as the code gets written and works either way, I don't think it's usually a huge deal. A lot of stuff will work fine either in core or as an extension -- this doesn't have to be made a religious issue or one where we have detailed official policies.
I certainly never mentioned anything about making this a religious issue (metaphor understood) but I think being able to point to a simple guideline on the wiki would be an improvement on the current situation.
This can be accomplished by regular old object-oriented programming. Keep all the related code in one class, and make as much possible private so that classes can only call a limited number of well-defined, well-documented, easily-understood entry points. I don't think extensions are a good model for this -- to the contrary, they're antithetical to modularity, since any extension can drastically change how any part of the program behaves (given enough hooks).
And what about javascript and css files? What about messages? Generally speaking lots of the MediaWiki PHP code is modular, but it's the rest of the stuff that goes into making a feature work that is not. Extensions bundle this all together, and that proximity makes maintenance and review easier.
- Trevor