Core Platform Team/Initiatives/Quantify and reduce coupling in MediaWiki Core

Initiative Description

< Initiatives


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 find 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.

Current investigation is ongoing here:

This project is likely to be scoped into smaller projects which are focused on specific parts of the code base.


Architect our code, services and infrastructure for change and sustainability

Baseline Metrics


Target Metrics



Extension developers

Core code developers

Known Dependencies/Blockers

Adding API integration tests

Architecture Principles

Epics, User Stories, and Requirements

< Initiatives

  • 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

Time and Resource Estimates

< Initiatives

Estimated Start Date

March 2019

Actual Start Date

None given

Estimated Completion Date

None given

Actual Completion Date

None given

Resource Estimates

None given


Core Platform

Open Questions

< Initiatives

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

Documentation Links

< Initiatives



Other Documents

None given