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

Try to modularize a not so legacy Android App

Stefan M.
October 29, 2019

Try to modularize a not so legacy Android App

Given at an internal company event.

This talk tells a story how I (and my team) tried to modularize a new Android App we developed for a customer.

Stefan M.

October 29, 2019
Tweet

More Decks by Stefan M.

Other Decks in Programming

Transcript

  1. Try to modularize
    a not so legacy Android App

    View full-size slide

  2. Customer:
    "I want an App and a SDK"

    View full-size slide

  3. The obvious solution
    someProject/android someProject/sdk

    View full-size slide

  4. The obvious solution
    someProject/android someProject/sdk
    consumes

    View full-size slide

  5. The obvious solution - requirements
    someProject/android someProject/sdk
    consumes
    artifactory CI/CD

    View full-size slide

  6. The modularization solution
    someProject/android
    /app
    /sdk
    Benefits:
    ● No headache with artifactory and CI/CD
    ● Development of the SDK is "on the fly"
    ● … more?!

    View full-size slide

  7. Customer:
    "The SDK should contain feature
    A,B,C and X,Y,Z"

    View full-size slide

  8. The obvious solution
    someProject/android Packages:
    awesome/feature/a
    awesome/feature/b
    awesome/feature/c
    awesome/feature/x
    awesome/feature/y
    awesome/feature/z
    /sdk

    View full-size slide

  9. The modularization solution
    someProject/android
    /y
    /c
    /b
    /a
    /z
    /x
    /sdk
    Benefits:
    ● Each is decoupled of others
    ● Could be published independently
    ● Wrapper SDK provide still the full SDK
    ● app modules could pick only features which they require
    ● … more?!

    View full-size slide

  10. Customer:
    "We use Scandit for scanning barcodes.
    Here are the licenses.
    Uh - and maybe we will replace it later
    with XYZ"

    View full-size slide

  11. The obvious solution - Try to abstract it away
    someProject/android
    /app
    /build.gradle
    add licenses
    Implementation:
    awesome/scaninng/
    abstract.kt
    scanditImpl.kt

    View full-size slide

  12. The modularization solution
    someProject/android
    /app
    /build.gradle
    add licenses
    Implementation:
    awesome/scaninng/
    abstract.kt
    internal/scanditImpl.kt
    /scanning
    Benefits:
    ● Clear separation in our build files
    ● scanning module can be changed without touching /app
    ● … more?!

    View full-size slide

  13. Developer:
    "Our onboarding is so heavily.
    Let's extract it"

    View full-size slide

  14. The obvious solution
    someProject/android
    /onboarding
    /app

    View full-size slide

  15. The obvious solution
    someProject/android
    /onboarding
    /app
    HELP!
    I need some files* from /app
    * files like `layouts` or utility classes

    View full-size slide

  16. The obvious solution
    someProject/android
    /onboarding
    /app
    /resources
    /utils

    View full-size slide

  17. The obvious solution
    someProject/android
    /onboarding
    /app
    /resources
    /utils
    HELP!
    I need some files from /sdk

    View full-size slide

  18. The obvious solution
    someProject/android
    /onboarding
    /app
    /resources
    /a
    /sdk

    View full-size slide

  19. The obvious (and correct) solution
    someProject/android
    /onboarding
    /app
    /resources
    /a
    /sdk

    View full-size slide

  20. Audience:
    "Well, that looks weird and complicated"

    View full-size slide

  21. Speaker:
    "No it's not. It's like playing lego and
    pick only the correct bricks together"

    View full-size slide