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

From mediawiki.org

Initiative Description

< Initiatives

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 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:

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

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

Outcomes

Architect our code, services and infrastructure for change and sustainability

Baseline Metrics

TBD

Target Metrics

TBD

Stakeholders

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

Collaborators

Core Platform

Open Questions

< Initiatives

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

Documentation Links

< Initiatives

Phabricator

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

Plans/RFCs

https://docs.google.com/document/d/16NwfSJuj7fc2da1fOJM_sqKMdioHN1qPQavydGLDxic/edit

Other Documents

None given

Subpages