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

Android Modular Architecture

Android Modular Architecture

Building a quality software is a complex task. This isn't just a matter of satisfying the business requirements. The software needs to be robust, easy-to-maintain, testable, and flexible to adapt to the various changes that an agile team needs to face.

In this presentation, I will walk you through planning and refactoring of a modern Android application built for a large-scale user base.

Marcello Galhardo

November 11, 2018
Tweet

More Decks by Marcello Galhardo

Other Decks in Programming

Transcript

  1. Christopher Alexander “It is the first steps in a design

    process which count for most. The first few strokes, creates the form.”
  2. Challenges • Independence: be able to work in a feature

    without impacting other developers.
  3. Challenges • Independence: be able to work in a feature

    without impacting other developers. • Encapsulation: effective use of access modifiers to hide information from different modules.
  4. Challenges • Independence: be able to work in a feature

    without impacting other developers. • Encapsulation: effective use of access modifiers to hide information from different modules. • Growth: a module should not increase size without bounds.
  5. Module by Layer In Module by Layer, the highest level

    modules reflect the various application "layers", instead of features.
  6. :app :domain :ui :data DI injects repository implementation in the

    domain. DI injects use case in the presentation.
  7. :app :domain :ui :data DI injects repository implementation in the

    domain. DI injects use case in the presentation. :app knows about all modules, and need to set up the DI.
  8. Challenges • Independence: features has its implementation spread out over

    multiple modules. • Encapsulation: modules contains items that usually aren't closely related to each other.
  9. Challenges • Independence: features has its implementation spread out over

    multiple modules. • Encapsulation: modules contains items that usually aren't closely related to each other. • Growth: As an application grows, the number of modules remains the same, while the number of classes in each module will increase without bound.
  10. The fundamental flaw with Module by Layer is that it

    puts implementation details ahead of high level abstractions.
  11. Module by Feature Module by Feature uses modules to reflect

    the feature set. It tries to place all items related to a single feature (and only that feature) into a single module.
  12. What is a feature? A feature is fully independent, fine-grained

    and self contained service those messages are delivered over Intent by URLs.
  13. Challenges • Independence: all items needed for a given feature

    are in the same module. • Encapsulation: allows classes to decrease their scope from public to internal.
  14. Challenges • Independence: all items needed for a given feature

    are in the same module. • Encapsulation: allows classes to decrease their scope from public to internal. • Growth: the number of classes within each package remains limited to the items related to a specific feature.