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 Slide

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

    View Slide

  3. The obvious solution
    someProject/android someProject/sdk

    View Slide

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

    View Slide

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

    View 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 Slide

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

    View 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 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 Slide

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

    View 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 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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  22. Q'nd A

    View Slide