Core Platform Team/Initiative/Quantify and reduce coupling in MediaWiki Core/Initiative Description

Project Leads
Daniel Kinzler

Current state
In planning, scoping work. Development starting soon.

Expected start
March 2019

Summary
This project aims to improve the modularity of the MediaWiki code base by reducing instances of tight coupling, with a focus on removing cyclic dependencies between components.

Significance and motivation
Small components with well defined interfaces are easier to understand and maintain than large complex components. Tight coupling between components, especially if circular, means that the two components behave as one, and cannot be understood or modified independently.

By removing coupling, we allow code to be put in a library. This makes future coupling impossible since it is no longer in the code base. It also makes our code usable in other projects outside of MediaWiki.

Having smaller components that can be understood and maintained separately means it becomes easier to modify the software, easier to fund bugs, and easier to train new engineers to work on the software. All of these factors contribute to the goal of delivering improvements to our users more quickly.

Milestones and major tasks

 * Perform analysis of tools for measuring coupling
 * Detect and analyze cyclic dependencies (use phpda)
 * Measure code abstraction and instability (use pdepend or phpmetrics)
 * Set up tools for continuous measurements over time
 * Analyze codebase to identify the first areas to decouple
 * Set baseline and target metric for decoupling
 * Refactor code to remove tight coupling in first areas
 * Reanalyze codebase to see next steps

Outcome
Architect our code, services and infrastructure for change and sustainability

Baseline

 * TBD

Target

 * TBD

Methodology and rationale
TBD. Current investigation is ongoing here:

https://docs.google.com/document/d/1hC4sYLsVN0bAVUHkCDPSk-RAjK6_2IYM_GBOjKmkk-M/edit#

Time and resource estimate
TBD - we must establish the baseline and a target. This project is likely to be scoped into smaller projects which are focused on specific parts of the code base.

Dependencies
Adding API integration tests

Architecture Principles

Collaborators
Core Platform

Stakeholders
Extension developers

Core code developers

Open questions

 * What is a reasonable metric and acceptable target for this project?

Phabricator
https://phabricator.wikimedia.org/project/manage/3729/

Relevant materials, plans and RFCs
https://docs.google.com/document/d/16NwfSJuj7fc2da1fOJM_sqKMdioHN1qPQavydGLDxic/edit