Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[Mateusz Herych] Architecture for App Bundles

[Mateusz Herych] Architecture for App Bundles

Presentation from GDG DevFest Ukraine 2018 - the biggest community-driven Google tech conference in the CEE.

Learn more at: https://devfest.gdg.org.ua

__

Android App Bundles were one of the most exciting announcements during this years Google I/O - they help you leverage the modular architecture of your apps in order to optimize your users' downloads. This all sounds cool, but what if your current codebase isn't modular at all?

During this presentation Mateusz will guide you through his team's journey of splitting a huge, monolithic app into smaller, independent pieces responsible for specific experiences. The journey that they started even before AppBundles were a thing. Join this talk to learn how:

- You can set up your dependency injection (e.g. with Dagger) with a multimodular project structure that AppBundles enforce.
- To navigate between different modules within your app.
- You can benefit from AppBundles beyond 'just' the architecture
- To structure your app modules in the version control system.
- You can reuse those modules across different apps.
- And more!

Google Developers Group Lviv

October 13, 2018
Tweet

More Decks by Google Developers Group Lviv

Other Decks in Technology

Transcript

  1. Will my team need to spend 2 man-years refactoring the

    code just to make our app compatible with that new thing Google announced at the I/O? DevFest Ukraine
  2. Our developer life up to January 2018 - app module

    for the Android stuff - core module for the business logic
  3. Our developer life up to January 2018 - app module

    for the Android stuff - core module for the business logic - data module for Jackson POJOs, Retrofit gateways, etc. - App depends on core & data. Data depends on core.
  4. Our developer life up to January 2018 - Lots of

    useless interfaces just to map stuff from one module to another.
  5. Our developer life up to January 2018 - Lots of

    useless interfaces just to map stuff from one module to another. (aka well abstracted, clean code)
  6. Our developer life up to January 2018 - Lots of

    useless interfaces just to map stuff from one module to another. (aka well abstracted, clean code) - Mappers everywhere
  7. Our developer life up to January 2018 - Lots of

    useless interfaces just to map stuff from one module to another. (aka well abstracted, clean code) - Mappers everywhere - Even simplest changes required recompiling all of the modules - quite a massive incremental build times.
  8. Our developer life up to January 2018 - Lots of

    useless interfaces just to map stuff from one module to another. (aka well abstracted, clean code) - Mappers everywhere - Even simplest changes required recompiling all of the modules - quite a massive incremental build times. - Single feature spread across entire codebase.
  9. New challenge - Expanding to a new market - Produce

    a new trading app for that market
  10. New challenge - Expanding to a new market - Produce

    a new trading app for that market - It has a relatively small functionality subset of the ‘monolith’
  11. New challenge - Expanding to a new market - Produce

    a new trading app for that market - It has a relatively small functionality subset of the ‘monolith’ - Most of those features behave the same
  12. New challenge - Expanding to a new market - Produce

    a new trading app for that market - It has a relatively small functionality subset of the ‘monolith’ - Most of those features behave the same - … and look the same
  13. New challenge - Expanding to a new market - Produce

    a new trading app for that market - It has a relatively small functionality subset of the ‘monolith’ - Most of those features behave the same - … and look the same - Core logic - dealing… is completely different.
  14. New challenge - Expanding to a new market - Produce

    a new trading app for that market - It has a relatively small functionality subset of the ‘monolith’ - Most of those features behave the same - … and look the same - Core logic - dealing… is completely different. - All the logic we do for the new app - we want it to be reusable in the monolith later on.
  15. Payments Onboarding Session Markets Payments Dealing Base App TINY! Only

    utilities here TINY! Just gluing stuff together.
  16. Few decisions - Feature modules don’t depend on each other

    - UI and the business logic are split - App depends on all the feature modules - All feature modules depend on base - (which means ‘base’ has to be app-agnostic)
  17. Imagine - User see a market list (that belongs to

    the `markets` module) - Tapping on the market item moves you to a dealing screen
  18. Imagine - User see a market list (that belongs to

    the `markets` module) - Tapping on the market item moves you to a dealing screen - (which belongs to the `dealing` module, which isn’t known by the `markets` module)
  19. app

  20. Navigation - Within the module, you just inject your navigator

    interface… voila! - Each module defines the interface with all the cross-module navigation actions it may trigger.
  21. Navigation - Within the module, you just inject your navigator

    interface… voila! - Each module defines the interface with all the cross-module navigation actions it may trigger. - Then, the exact behavior, is defined by the `app` module (which defines the navigation between modules)
  22. Decorators - Actual DecoratorCommand implementations can be defined within modules

    - App decides which DecoratorCommands to use - Some Decorators make use from the contract - e.g. you need to have R.id.bottomContainer within your Activity’s layout
  23. Some blogposts claim, that Dynamic Feature Modules are like Android

    Library Modules. But there’s a pretty fundamental difference.
  24. In other words: ‘app’ (or ‘base’) won’t be able to

    access the classes of a dynamic feature module.
  25. You don’t have to change your architecture to support AppBundles

    - you can benefit from them without much of the effort.
  26. Purpose of our modular approach: good separation, lack of coupling

    between features enforced in compile-time.
  27. What is a good candidate for a dynamic feature module?

    - Something that only portion of your users need. - Something that users won’t likely need in a short-time after the installation.
  28. What is a good candidate for a dynamic feature module?

    - Something that only portion of your users need. - Something that users won’t likely need in a short-time after the installation. Document Upload feature? Maybe Payments?