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

Modularization - How hard can it be? (Droidcon ...

Modularization - How hard can it be? (Droidcon London 2018)

Recording can be found here: http://uk.droidcon.com/skillscasts/12186-modularization-how-hard-can-it-be

Modularizing Android codebases is all the hype these days. It can be as simple as moving a few files, and maybe creating a new build config or two along the way, or it can be much more gruelling. At Spotify, it has meant clearing out years and years of tech debt, re-writing APIs, rethinking the architecture and structure of the application and features that goes into it, wrestling with build tools, and then some.

This talk will walk you through the Spotify modularization journey: why we got started, how we went about it, what we have learned through the process, and also why you should be thinking about modularizing your code, if you haven't already started.

Links shared in the presentation:

Instagram: https://atscaleconference.com/videos/app-modularization-and-module-lazy-loading/
Square: https://youtu.be/GesiS2bkTKA
Yelp: https://engineeringblog.yelp.com/2018/06/how-yelp-modularized-the-android-app.html
Soundcloud: http://uk.droidcon.com/skillscasts/10525-modularizing-android-applications
Google: https://youtu.be/tYf9ivnQ0eI
Plaid: https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e
Spotify (previous, slightly different version of this talk): https://youtu.be/opsiSaUS2bg

Elin Nilsson

October 28, 2018
Tweet

More Decks by Elin Nilsson

Other Decks in Technology

Transcript

  1. :app :http :logg er :audi o :vide o :arti st

    :sear ch :ui :radi o :rxja va :dag ger :dep -inj
  2. :app :features :common :libs :http :logger :audio :video :artist :search

    :ui :library :feed :profile :radio :radio :android :ui-tools :follow :share :mobius :dep-inj
  3. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules
  4. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management!
  5. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules
  6. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules a. Analyse dependencies
  7. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules a. Analyse dependencies b. Break dependencies
  8. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules a. Analyse dependencies b. Break dependencies i. Works? Great! Move it!
  9. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules a. Analyse dependencies b. Break dependencies i. Works? Great! Move it! ii. Doesn’t work? Try again later
  10. one feature outside of the monolith 1st 1. Come up

    with a module structure 2. Create some modules a. Dependency management! 3. Put stuff in the modules a. Analyse dependencies b. Break dependencies i. Works? Great! Move it! ii. Doesn’t work? Try again later 4. Rinse and Repeat! Forever!
  11. one feature outside of the monolith 1st frameworks and APIs

    outside the monolith 2nd (almost) everything outside the monolith ulti mat e
  12. 2015 2016 2017 LOC in repo LOC NOT in the

    monolith LOC in the monolith
  13. If new code is written as if it was in

    a module, it will be easier to modularize
  14. Best practices in practice Deprecate and remove legacy code Stop

    re-implementing the wheel Stop leaking implementation details
  15. Best practices in practice Deprecate and remove legacy code Stop

    re-implementing the wheel Stop leaking implementation details Use dependency injection
  16. Best practices in practice Deprecate and remove legacy code Stop

    re-implementing the wheel Stop leaking implementation details Use dependency injection Structure! Code organization! Consistency!
  17. Best practices in practice Deprecate and remove legacy code Stop

    re-implementing the wheel Stop leaking implementation details Use dependency injection Structure! Code organization! Consistency! SOLID principles
  18. SOLID S - Don’t do a lot of things in

    one class O - Design the API of the class so that it can be used and extended without being modified L - Don’t let implementations of the same interface behave differently I - Don’t design big interfaces D - Depend on abstractions, not on implementations
  19. SOLID S - Don’t do a lot of things in

    one class O - Design the API of the class so that it can be used and extended without being modified L - Don’t let implementations of the same interface behave differently I - Don’t design big interfaces D - Depend on abstractions, not on implementations
  20. 2015 2016 2017 2018 LOC in repo LOC NOT in

    the monolith LOC in the monolith
  21. “Single modules are easier to deal with; there are no

    complex dependency graphs to account for [...]” - Yelp
  22. “Single modules appear to be easier to deal with; there

    are no complex dependency graphs to account for [...]” - Yelp (revised by Elin)