QQ Space Architecture Refactoring: A Case Study of Modernizing a 18-Year-Old Mobile App
The QQ Space team modernized their 18‑year‑old, 1.5‑million‑line mobile app by incrementally refactoring a tangled “primeval forest” architecture using the RFW‑Part and Section frameworks, layered design, and monitoring tools, cutting code size dramatically, boosting startup speed by over 50 % and improving FPS by nearly 5 %.
This article documents the architecture refactoring journey of QQ Space, one of Tencent's oldest mobile products, which recently turned 18 years old. The QQ Space client team undertook this massive reconstruction to address years of technical debt accumulated through multi-team collaborative development.
Background and Motivation: As a platform-type business, QQ Space had code spanning over 1.5 million lines running across 5 processes and 2 plugins. The code quality had degraded significantly, with 30+ new historical bugs appearing in every version even without any code changes. The architecture had become a "primeval forest" - easy to enter but impossible to exit.
Architecture Degradation Factors: The article analyzes how a clean architecture gradually degrades: 1) Low extensibility forcing business code to invade technical components; 2) Lack of code isolation and programming paradigms causing coupling between teams; 3) Exploding maintenance costs creating a vicious cycle; 4) Feeds stream complexity growing to 18 scenarios with 60+ card types.
Refactoring Strategy: The team focused on four key aspects: 1) Incremental refactoring using RFW-Part framework for "changing tires on the highway"; 2) Improving extensibility and reusability through layered architecture; 3) Long-term complexity control via Part + Section decomposition; 4) Degradation prevention with monitoring systems.
Technical Solutions: The article details the RFW-Part framework (page-level UI container with lifecycle awareness), Section framework (for Feeds stream card decomposition), IOC framework for cross-layer communication, and various optimization techniques including async layout rendering, precise preloading, and lifecycle extension.
Results: After refactoring, the friend dynamics page code was split into 27 Parts, reducing from 6000+ lines to 320 lines. Cold startup speed improved by 56%, hot startup by 53%, and FPS improved by 4.9%.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.