On 03/31/2014 06:14 PM, Sumana Harihareswara wrote:
On 02/26/2014 12:23 PM, Daniel Kinzler wrote:
I have just pushed a new version of the
TitleValue patch to Gerrit:
<https://gerrit.wikimedia.org/r/106517>.
I have also updated the RDF to reflect the latest changes:
<https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue>.
Please have a look. I have tried to address several issues with the previous
proposal, and reduce the complexity of the proposal. I have also tried to adjust
the service interfaces to make migration easier.
Any feedback would be very welcome!
-- daniel
Update:
https://gerrit.wikimedia.org/r/#/c/106517/ has now been merged.
To quote the commit message:
> The intention is to improve testability and reusability; these
> advantages will however only become apparent with further refactoring
> of the respective special pages. This will be done in follow-up
> changes.
>
> More work will be needed to migrate essential functionality from
> Title and Linker classes into the respective service classes,
> MediaWikiTitleCodec and MediaWikiPageLinkRenderer.
I asked Daniel what we need to do next on TitleValue and he said:
Sorry for not getting back to you on this sooner.
It's a bit tricky to say what
the next steps would be. There is several directions we could take this. But
none of them fit naturally with my Wikidata work, so I can only try to squeeze
in bits and pieces every now and then. Would be great to get more people in on this.
Anyway, here is what could be done:
1) Using TitleValue in more places. There's a refactoring of CategoryLinks [1]
that I still need to update and rebase, and more special pages and API modules
could follow this approach. This would improve testability, in particular.
2) Contimue wrapping up lose ends left by the TitleValue refactor. The code for
splitting a title into its components needs to be refactored and tidied, in
particular. This also means writing lots of tests for the current behavior of
Title, so we don't change it.
3) factor more things out of the Title class. TitleValue is just the start. We
could factor out the logic for permission checks into a separate "service";
Also, we could start defining value objects for different kinds of links
(internal, interwiki, external, etc) on top of/in addition to TitleValue. Note
that the conflation of "title" and "link target" is the cause of
quite a bit of
confustion.
4) Refactor other "nasty" parts of MediaWiki. Some prime candidates are
Linker,
User, and WikiPage. Actually, ContentHandler could also use an overhaul: Content
should be a plain value interface, all "smart" aspects should be factored into
services.
So much to code, so little time :)
This kind of lots-of-little-refactorings work feels like a good
candidate for a sprint at the Zurich hackathon, where people who don't
know this codebase very well can help out. Daniel, do you agree?
--
Sumana Harihareswara
Senior Technical Writer
Wikimedia Foundation