ASOS Sean Coyle Jul 19, 2023

Slaying the Monolith: API Implementation and Modularization in Android

Article Summary

Sean Coyle from ASOS reveals how they're dismantling their Android monolith using a pattern that slashes recompile times. The secret? Splitting every feature into API and implementation modules.

ASOS's Android team faced the classic monolith problem: slow builds, tangled dependencies, and features that couldn't evolve independently. Coyle walks through their modularization strategy using the API/Implementation pattern, a dependency inversion approach that separates what modules do from how they do it.

Key Takeaways

Critical Insight

The API/Implementation pattern enables independent feature evolution and faster compile times by decoupling module contracts from their concrete implementations.

The article includes a practical MusicService example showing exactly how to bridge API and implementation using dependency injection.

About This Article

Problem

ASOS's Android app became a monolith after years of adding features. This created real problems: builds took too long, code couldn't be reused easily, and features like authentication, image processing, and data analysis were tangled together without clear boundaries.

Solution

Sean Coyle's team split each feature module into two parts using the API/Implementation pattern. One part is the API module with interfaces and contracts. The other is the implementation module with the actual code. Dependency injection frameworks like Dagger or Hilt connect them together.

Impact

When someone changes an implementation module, it no longer forces a full recompile of everything that depends on it. Other modules only talk to the stable API contracts, so compile times dropped significantly. Teams can now work on features independently without stepping on each other's toes.