When a mobile team says the codebase needs to be modularized, the pitch is usually speed. Sometimes that pays off. The stronger case is the one about people: who owns what, and what stops one team from breaking another by accident.
The Problem It Solves
Google's guidance for Android describes the decline every growing product goes through: "In an ever-growing codebase, scalability, readability, and overall code quality often decrease through time" (Android). The symptom leaders hear about is unpredictability: "In a tightly coupled codebase a single change can trigger a cascade of alterations in seemingly unrelated parts of code." That is the mechanism behind an estimate that keeps slipping.
We Removed a Promise
Our engineering article on this subject used to promise a 40 to 60 percent cut in build time. No source says that, and the number is gone. What the guidance claims is conditional. Build tooling can take advantage of a modular structure, and it does not have to. The same document lists the cost: "Every module brings a certain amount of overhead in the form of increased build complexity and boilerplate code."
It Is Not Always the Answer
The guidance is unusually willing to say no: "It doesn't always make sense to modularize your project. A dominating factor is the size of the codebase." A team of four on a small app that spends a quarter restructuring has bought overhead and nothing else.
What It Does Guarantee
Some benefits come only with real boundaries. Reuse across products, strict control over what one part of the code can see of another, and delivering features on demand "are only achievable with a modularized codebase". The principle underneath is worth repeating to any team that proposes the work: "Low coupling means that modules should be as independent as possible from one another". If the plan does not reduce how much the parts know about each other, it is a reorganization of folders.
What to Ask Your Team
- Which problem are we solving? Build time, ownership, or reuse. The plan differs for each.
- Who will own each module? A boundary without an owner erodes.
- What enforces the boundaries? A convention people remember, or the compiler.
- How will we know it worked? Name the measurement before starting.
-Rocky
#SoftwareArchitecture #EngineeringLeadership #TechnicalDebt #EngineeringDreams #StrategiaX
Originally published on ANDROID-ARCHITECT, the Android engineering blog of Strategia-X, with the module layout and the code.
