There seem to be two groups of extensions: those which are not really maintained, and those with active maintenance and development work. We are relatively strict keeping our new core code backwards compatible (BC). That compatibility does not come free, but who is it for? It is for people who are not following MediaWiki development and it is for letting unmaintained extensions to work for a few more years.
Having said that, I think BC is important and we should continue be as strict about it as we have been. The current practice seems to be: 1) keep the old interface available unless it makes no sense anymore 2) add @deprecated in X, warnings in X+2, removed in X+4 where X is the current development version, the numbers may wary a little 3) update all extensions in the svn to use the new interface (with exception, see rest of this message) 4) add warnings and remove in version stated in 2)
But I also think there is place for us core developers to help the other group of extensions. What are we doing for people who are actively developing and maintaining extensions, trying to keep up with the latest interfaces and best practices? Usually these extensions want to support multiple version of MediaWiki simultaneously. Think about the Semantic MediaWiki extensions and the Translate extension. I will now talk about two practices, which would in my opinion be helpful.
Instead of just updating the code of those extensions to the new interface directly, right now we have to add conditions like if ( foo ) { do_it_the_new_way() } else { do_it_the_old_way() }. or use more convoluted mechanisms. Without coordination different people make different solutions.
I propose that we adopt a practice of amending old releases with new interfaces, essentially moving the burden from extensions to the core code itself. This doesn't mean that the whole new code needs to be backported. Take the RequestContext interface for example. We could very well add methods of this kind to our classes in 1.17: public function getUser() { global $wgUser; return $wgUser; }
I think it doesn't make sense to go further back than the latest stable release, or maybe even just the branched release if going back to the stable release would be particularly hard to do. For example, depending how easy it is to add the interface to older versions, right now it might make sense to add the new interface(s) only to 1.18 and forward, and not 1.17. I think this is called forwards compatibility (FC). The idea is that users are not going to update to development versions or even major releases very fast, but they could do a minor update and keep enjoying latest versions of their favorite extensions.
Another idea is adding @since annotations to new methods and classes and other changes. It's not fun to check the history of every function and determine the date it was added, just to make sure you don't accidentally introduce breakage when someone installs your extension in an older MediaWiki. Right now, the practice of adding @since annotations is not consistently followed or enforced.
I would like for us to: 1) start enforcing @since annotations for new core code 2) encourage adding FC interfaces to previous branches where possible (and to also make releases out of those branches including the interfaces)
-Niklas
Hey,
- start enforcing @since annotations for new core code
This would help so much :) I requested this about half a year back and got a bunch of sarcasm back then. Quite often I find out that I released some version of some extension that's not compatible with an older version of MediaWiki it's supposed to be compatible with, since I used a newly introduced method without realizing it. Then I need to find out where this is used, what version of MW it was introduced in (lot's of fun this step), add the @since annotation to core, update all extensions that are using this while they can't with b/c code, and make new releases for all these extensions. That's a lot of work, so I don't think it's to much to ask to add an @since tag to everything you add, how silly it might look (to you).
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
On Fri, Sep 2, 2011 at 4:40 PM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
- encourage adding FC interfaces to previous branches where possible
(and to also make releases out of those branches including the interfaces)
By forward compat do you mean stuff like https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki... ?
Roan
"Niklas Laxström" niklas.laxstrom@gmail.com wrote in message news:CAAVd=jbYKaqR83tbwHAOiFiqrb_wcF70Jk=zdLqTWfiUMJn1_A@mail.gmail.com...
I would like for us to:
- start enforcing @since annotations for new core code
- encourage adding FC interfaces to previous branches where possible
(and to also make releases out of those branches including the interfaces)
I'm all in favour of requiring higher standards for documentation and annotations, as long as they are enforced consistently and everyone, however experienced, gets the same level of amiable prodding to conform to them. I'm also a fan of backporting interfaces as far as possible (I've broken a number of 1.19 commits into two bits and marked one of them for backporting to 1.18, for instance); but I wouldn't go so far as to say we should be adding features to released versions. I think we have enough of a workload with controlling one active release branch, and that trying to manage a second would merely distract us from the business of actually implementing these new features in the first place.
--HM
Am 02.09.2011 16:40, schrieb Niklas Laxström:
... The current practice seems to be:
- keep the old interface available unless it makes no sense anymore
- add @deprecated in X, warnings in X+2, removed in X+4 where X is
the current development version, the numbers may wary a little
Niklas,
thank you. I wish you would have opened a new page on MediaWiki - and explained in detail to people like me, what exactly you expect, and what are the standards.
Honestly, I'm a still a newbie for all the nice @gadgets you have - please add a [ short and concise ] page and examples, which can be included in the http://www.mediawiki.org/wiki/MDG D(MW Developer's Guide) and which I can study.
And obey.
Tom
On Sat, Sep 3, 2011 at 12:40 AM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
We are relatively strict keeping our new core code backwards compatible (BC). That compatibility does not come free, but who is it for?
Well it sort of does come free, just most people don't seem to use it.
We already have "/tags/RELX_YY_Z/extensions" (and "/tags/extensions" if they don't follow release numbering schemes (Example here are the Semantic* exts)) as well as "/branches/RELX_YY/extensions" where developers can keep extensions in a state to support BC with that version whilst integrating new features, One example of a dev doing this is the one working on the Favourites extension.
Along these lines, does it make sense to develop extensions against the last release when possible (that is, avoid new interfaces until they're actually available)? Extensions are coded a lot faster than core, and are released more often, but our default behavior seems to be to code against trunk, which can be months ahead of whatever is considered stable.
I know we plan to change this, and deploy trunk as often as every week, but even then our packaged releases (ie. the core code used everywhere outside the WMF) could be months old.
-Ian
On Fri, Sep 2, 2011 at 4:47 PM, K. Peachey p858snake@gmail.com wrote:
On Sat, Sep 3, 2011 at 12:40 AM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
We are relatively strict keeping our new core code backwards compatible (BC). That compatibility does not come free, but who is it for?
Well it sort of does come free, just most people don't seem to use it.
We already have "/tags/RELX_YY_Z/extensions" (and "/tags/extensions" if they don't follow release numbering schemes (Example here are the Semantic* exts)) as well as "/branches/RELX_YY/extensions" where developers can keep extensions in a state to support BC with that version whilst integrating new features, One example of a dev doing this is the one working on the Favourites extension.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Putting my sysadmin hat on, I would prefer that extensions be coded against the current stable release. I realize that there's a great temptation to code ahead and use new features/interfaces, but I almost always encounter pushback when the only way to do something is to use a beta version. Lots of outside organizations are going to be unwilling (or unable due to corporate policies) to run a trunk version of MW.
-Chris
On Wed, Sep 7, 2011 at 5:27 PM, Ian Baker ian@wikimedia.org wrote:
Along these lines, does it make sense to develop extensions against the last release when possible (that is, avoid new interfaces until they're actually available)? Extensions are coded a lot faster than core, and are released more often, but our default behavior seems to be to code against trunk, which can be months ahead of whatever is considered stable.
I know we plan to change this, and deploy trunk as often as every week, but even then our packaged releases (ie. the core code used everywhere outside the WMF) could be months old.
-Ian
On Fri, Sep 2, 2011 at 4:47 PM, K. Peachey p858snake@gmail.com wrote:
On Sat, Sep 3, 2011 at 12:40 AM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
We are relatively strict keeping our new core code backwards compatible (BC). That compatibility does not come free, but who is it for?
Well it sort of does come free, just most people don't seem to use it.
We already have "/tags/RELX_YY_Z/extensions" (and "/tags/extensions" if they don't follow release numbering schemes (Example here are the Semantic* exts)) as well as "/branches/RELX_YY/extensions" where developers can keep extensions in a state to support BC with that version whilst integrating new features, One example of a dev doing this is the one working on the Favourites extension.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
This is essentially why I've always preferred trunk extensions to be written to be compatible with at least latest stable. Most extension developers don't test and backport their changes to REL#_## branches so I've always installed trunk versions of extensions into my stable installations of MediaWiki. Frankly I don't consider /trunk/extensions to be the same as /trunk/phase3. To me /branches/REL#_##/phase3 has always been stable, /trunk/phase3 unstable in-development, /trunk/extensions the latest usable version of an extension, while /branches/REL#_##/extensions is a last-resort backup if the trunk version of an extension isn't functioning, or you're using and old version of MediaWiki.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
On 11-09-07 05:44 PM, Christopher Wilson wrote:
Putting my sysadmin hat on, I would prefer that extensions be coded against the current stable release. I realize that there's a great temptation to code ahead and use new features/interfaces, but I almost always encounter pushback when the only way to do something is to use a beta version. Lots of outside organizations are going to be unwilling (or unable due to corporate policies) to run a trunk version of MW.
-Chris
On Wed, Sep 7, 2011 at 5:27 PM, Ian Baker ian@wikimedia.org wrote:
Along these lines, does it make sense to develop extensions against the last release when possible (that is, avoid new interfaces until they're actually available)? Extensions are coded a lot faster than core, and are released more often, but our default behavior seems to be to code against trunk, which can be months ahead of whatever is considered stable.
I know we plan to change this, and deploy trunk as often as every week, but even then our packaged releases (ie. the core code used everywhere outside the WMF) could be months old.
-Ian
On Fri, Sep 2, 2011 at 4:47 PM, K. Peachey p858snake@gmail.com wrote:
On Sat, Sep 3, 2011 at 12:40 AM, Niklas Laxström niklas.laxstrom@gmail.com wrote:
We are relatively strict keeping our new core code backwards compatible (BC). That compatibility does not come free, but who is it for?
Well it sort of does come free, just most people don't seem to use it.
We already have "/tags/RELX_YY_Z/extensions" (and "/tags/extensions" if they don't follow release numbering schemes (Example here are the Semantic* exts)) as well as "/branches/RELX_YY/extensions" where developers can keep extensions in a state to support BC with that version whilst integrating new features, One example of a dev doing this is the one working on the Favourites extension.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Fri, Sep 2, 2011 at 7:40 AM, Niklas Laxström niklas.laxstrom@gmail.comwrote:
Having said that, I think BC is important and we should continue be as strict about it as we have been. The current practice seems to be:
- keep the old interface available unless it makes no sense anymore
- add @deprecated in X, warnings in X+2, removed in X+4 where X is
the current development version, the numbers may wary a little 3) update all extensions in the svn to use the new interface (with exception, see rest of this message) 4) add warnings and remove in version stated in 2)
Generally speaking, we should only throw warnings or remove old interfaces that are actively broken (do not work correctly) or can no longer be sanely maintained -- removing a deprecated interface is a fairly extreme step and should never be done just to make things look cleaner.
There may be little or even *negative* benefit to going around and changing all the calling code to use the new interface. I've seen *lots* of regressions in commits that swap something to a new interface without taking into account how the interface actually changed, and they're harder to track down because the changes are often buried in generic code clean-up.
Instead of just updating the code of those extensions to the new interface directly, right now we have to add conditions like if ( foo ) { do_it_the_new_way() } else { do_it_the_old_way() }. or use more convoluted mechanisms. Without coordination different people make different solutions.
Updating code to use newer interfaces is only actually needed if there's an advantage to using the new interface, such as better performance or higher capabilities. If you don't need it, you can and maybe should just keep using the old interface!
It doesn't hurt to leave an explicit comment saying why you're using an older interface for compatibility, of course, so some smart guy doesn't come along and replace all your calls with the new interface. ;)
So old extension code *should* just keep on working on new versions in the vast majority of cases; conditional use is only relevant if you actually need the different capabilities or performance characteristics... an example is using the modern system for setting up parser hooks on first parser initialization, instead of forcing the parser to load early just to register hooks.
I propose that we adopt a practice of amending old releases with new interfaces, essentially moving the burden from extensions to the core code itself. This doesn't mean that the whole new code needs to be backported. Take the RequestContext interface for example. We could very well add methods of this kind to our classes in 1.17: public function getUser() { global $wgUser; return $wgUser; }
IMO this is not a good idea; adding interfaces to an old version greatly increases the possibility of introducing errors to the old version, and creates more variability between sub-versions of a stable release branch. Some interface changes are also very complex -- "just adding" a few functions for RequestContext sounds like a sure recipe for getting something wrong. :)
"This works in 1.18 and later" is easier to understand than "This works in 1.18 and later, and also 1.17 but only 1.17.6 and later, and it still might not work because that 1.17 stub code may or may not actually work how you think it does from using the interface on 1.18".
Another idea is adding @since annotations to new methods and classes
and other changes. It's not fun to check the history of every function and determine the date it was added, just to make sure you don't accidentally introduce breakage when someone installs your extension in an older MediaWiki. Right now, the practice of adding @since annotations is not consistently followed or enforced.
Generally helpful, but note that @since alone doesn't always help as function signatures, accepted parameters, return values, side effects, etc also sometimes change over time. Ideally any kind of behavior change should be documented in the doc comments though, yes!!
As far as accidentally introducing breakages -- don't forget to actively *test* your extension with every version of MediaWiki that you say you support. Even without explicit interface changes there may be changed behavior or assumptions that you might forget at some point, and failing to test means you won't discover the problems until it's gone out into someone's hands.
Be sure to automate testing as much as possible, as humans are notoriously bad at remembering to do things regularly that are mildly inconvenient. :)
-- brion
On Tue, Sep 6, 2011 at 2:05 PM, Brion Vibber brion@pobox.com wrote:
Generally speaking, we should only throw warnings or remove old interfaces that are actively broken (do not work correctly) or can no longer be sanely maintained -- removing a deprecated interface is a fairly extreme step and should never be done just to make things look cleaner.
There may be little or even *negative* benefit to going around and changing all the calling code to use the new interface. I've seen *lots* of regressions in commits that swap something to a new interface without taking into account how the interface actually changed, and they're harder to track down because the changes are often buried in generic code clean-up.
+1000.
Rob
wikitech-l@lists.wikimedia.org