Posted by Miłosz Moczkowski, Developer Relations Engineer, Android
As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.
All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:
“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”
On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
- What is modularization?
- What are the benefits of modularizing my codebase?
- What are the things to watch out for when modularizing?
- Is modularization the right technique for you?
- What is the low coupling & high cohesion principle?
- What are the types of modules and their roles?
- How do modules pass data between each other?
To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.
Is this for you?
This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.
It’s just a beginning
We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.