BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Releases a Guide to Android App Modularization

Google Releases a Guide to Android App Modularization

Lire ce contenu en français

Bookmarks

Google has recently released a guide to Android app modularization. This guide is designed to bring best practices and recommended patterns for developers to build multi-module Android apps, focusing on mitigating problems that arise when the codebase grows, such as scalability, readability, stability, and testability.

After a survey asking developers about their experience with modularization, where 54% of participants mentioned that it was difficult to find good learning materials about modularization, and almost 95% claimed that the material available on developer.android.com was insufficient, Google decided to launch a guide to Android app modularization. It is important to note that the guide is targeted at intermediate and advanced developers, who usually are familiar with recommended app architecture.

According to Google, some of their apps are already using modularization, such as Play Store, Google News, and YouTube.

Modularization is a practice of organizing the codebase into loosely coupled parts, usually named modules. Each module must be independent and designed to serve a clear purpose.

(image taken from https://developer.android.com/topic/modularization)

Modularization brings many advantages; modules reduce the complexity of designing, making it easier to maintain, and evolve large systems. Let's have a look at some of these benefits:

  • Reusability: brings the opportunity to share code and build multiple apps using the same module; an app should be a sum of many modules, where each module contains specific features
  • Strict visibility control: allows developers to easily control what should be exposed to other parts of the codebase and modules
  • Customizable delivery: Play Feature Delivery allows developers to deliver specific features of the app conditionally or by demand

Other benefits might be achieved easily when using modularization. They are:

  • Scalability: when a project is properly modularized, there is usually a separation of concerns principle and a loosely coupled codebase, making it easier to maintain and evolve the system
  • Ownership: modules can be used to enforce accountability, having a dedicated owner who is responsible for maintaining the code, fixing bugs, adding tests, and reviewing changes
  • Encapsulation: meaning that modules should have the smallest possible amount of knowledge about other parts. Isolated code makes it easier to read, understand and evolve
  • Testability: the ability to test the code; it is easier and faster to test modules than to test a large tightly-coupled system
  • Build time: related to incremental build, build cache or parallel build that some Gradle functionalities can leverage from modularity to improve build performance

Google made available the multi-module app Now in Android in a GitHub repo, with a handy modularization journey that outlines what the modules do and how they communicate with each other.

The guide also contains a section related to common modularization patterns, where you can find more info about low coupling and high cohesion, data modules, feature modules, app modules, common modules, and so on.

About the Author

Rate this Article

Adoption
Style

BT