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

Android apps architecture

Android apps architecture

A quick comparison of used architectures in android applications. MVC/MVP/MVVM, android architecture components and clean architecture.

Bajic Dusko

December 16, 2017
Tweet

More Decks by Bajic Dusko

Other Decks in Programming

Transcript

  1. WHY ▸ Scalability ▸ Reliability ▸ Maintainability ▸ Implementation cost

    ‣ Reusability ‣ Separation of concerns ‣ Independence of libs ‣ Testability I am worried about: How can I help myself?
  2. OLD WAY Everything is in activity - activity is everywhere

    One module ‣ app ‣ ui activities fragments util ‣ core api database provider model
  3. MVC Not a web MVC! MODEL CONTROLLER VIEW What can

    we achieve ? Separation of business logic from 
 presentation To write less code What do we have? Controller as central point of 
 implementation Stateless views When to use ? Small projects Demo
  4. MVC MODEL CONTROLLER VIEW BAD Highly coupled Hard to test

    Not scalable GOOD Less boilerplate Very easy to start with Separates business-presentation
  5. MVP What can we achieve ? Decoupling Scalability Testability Reusability

    of presenter When to use ? In big teams On large projects What do we have? Independent presenter View hidden behind interface VIEW VIEW INTERFACE PRESENTER MODEL
  6. MVP BAD More boilerplate Harder to maintain all interfaces GOOD

    Scalable Testable Modular Separation of concerns Reusable VIEW VIEW INTERFACE PRESENTER MODEL
  7. MVVM VIEW VIEW MODEL DATA MODEL What do we have?

    MVP like structure Event publisher What can we achieve ? Decoupling Scalability Testability (IOC) Reactive approach When to use ? In big teams On large projects When all teammates are ready for such 
 approach
  8. MVVM VIEW VIEW MODEL DATA MODEL BAD Different paradigm Depends

    of third party library GOOD Scalable Testable Modular Separation of concerns Reusable
  9. CLEAN ARCHITECTURE ‣ Repository pattern ‣ Builder pattern ‣ Dependency

    injection ‣ Modulized ‣ Model per module ‣ Interfaces