Slide 1

Slide 1 text

1 Android App Modularization How hard can It be modularize the application Created on 24 May 2023 by Thaw Zin Toe ( Ptut)

Slide 2

Slide 2 text

2 Problem 01 Large Code Base Management 02 Longer Build Times monolithic codebase harder to navigate and manage 03 Limited Code Reusability Higher code duplication 05 Inefficient Testing Test entire application for small change 06 Difficult in Scaling Complex and riskier Time-consuming for larger codebase 04 Team Collaboration Challenges Lead to merge conflicts and slow down the development process 07 Complicated Dependency Management Managing dependencies is hard

Slide 3

Slide 3 text

3 What is Modularization ● organizing codebase that separate into smaller module ● Independent & Clean Purpose ● Simplifies project management, improves scalability, and allows for easy addition or removal of features. Android App Modularization ● Customizable delivery to users

Slide 4

Slide 4 text

A Modudule Graph in NowInAndroid 4 Android App Modularization

Slide 5

Slide 5 text

Pros of Modularization 5 leads to a more efficient, manageable, and scalable app development process. It also results in a better user experience, as the app can be smaller, faster, and more stable. Clear Separation Faster Gradle Build Support for Instant App & Dynamic Feature Make parts of your App reusable

Slide 6

Slide 6 text

Cons of Modularization 6 Be careful planning and effective use of tools and practices. Inter-module communication is complex Learning Curve is high A lots of initial setup involved Not Knowing what you’re doing will strongly backfire

Slide 7

Slide 7 text

Common Modularization Patterns 7 What is Layer vs Feature? Question

Slide 8

Slide 8 text

8 Layer - Based Modularization ● 3 modules Presentation , Domain and Data. Choosing right modularization architecture ● Module are not reusable ● Hard for developers to work in isolated environments ● Big Module → Slow Build

Slide 9

Slide 9 text

9 Feature - Based Modularization ● One module per feature Choosing right modularization architecture ● Size is limited ● Developers can work better in isolation ● Reusable modules ● No clear separation of concerns

Slide 10

Slide 10 text

10 Layered - Feature Modularization ● Modularization by feature with layer sub modules Choosing right modularization architecture ● Combines advantages of Layer and feature-based modularization ● Developers can work better in isolation ● Reusable modules ● clear separation of concerns

Slide 11

Slide 11 text

Layer + Feature Modularization 11 Choosing right modularization architecture

Slide 12

Slide 12 text

Layer + Feature Modularization 12 Choosing right modularization architecture

Slide 13

Slide 13 text

Type of Modules 13 All types of modules in modularization Explanation

Slide 14

Slide 14 text

14 Data Module ● Encapsulate all Data and Business logic of a certain domain Type of modules ● Expose the repository and datasource as an external API ● Hide all implementation details and data source from the outside

Slide 15

Slide 15 text

15 Feature Module ● Feature-Specific Code and Resources Type of Modules ● Associated User Interface ● Feature Specific Business Logic

Slide 16

Slide 16 text

Sample Feature Module 16 Type of modules

Slide 17

Slide 17 text

17 App Module ● Entry-Point of Application Type of modules ● target multiple device types, such as Auto, Wear or TV ● separate platform specific dependencies

Slide 18

Slide 18 text

“Demo” and “Full” flavor module 18 Type of modules

Slide 19

Slide 19 text

19 Common & Core Module Type of modules We can add third party integration libraries into common module. Eg. for imageLoading , we can use any third-party library Glide, Picasso and Coil etc... If something problem we want to change image library, wechange only in this module.

Slide 20

Slide 20 text

What we need to Care in Modularization? 20 Avoids & Tips

Slide 21

Slide 21 text

Avoid Module to Module Communication Avoid 01 Clear Boundaries & Plan for Future Define 02 Creating so many small modules & over modularize Avoid 03 Project Document and Communicate Define 04 What we need to care in modularization

Slide 22

Slide 22 text

Gradle Incremental Build 22 api : dependencies which is exposed to other modules that consume your module. implementation: dependencies which is used internally between modules. “

Slide 23

Slide 23 text

Thank you! goo.gle/assistant-docs goo.gle/assistant-newsletter @ActionsOnGoogle GoogleDevelopers Resources Mobile Android Developer At Seven Peaks Thaw Zin Toe Pe Tut thawzintoe-ptut @thaw_zin_toe