Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android Architectures

121 views

Published on

MVC, MVP and MVVM

Sample Code:

MVP : https://github.com/googlesamples/android-architecture/tree/todo-mvp/

MVVM : https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/

MVP/Dagger2/RxJava : https://github.com/maour/sample

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Android Architectures

  1. 1. A N D R O I D A R C H I T E C T U R E S MVC, MVP, MVVM
  2. 2. A B O U T M E Majid Ramezanpour majid.ramezanpour@gmail.com
  3. 3. I F Y O U T H I N K G O O D A R C H I T E C T U R E I S E X P E N S I V E , T R Y B A D A R C H I T E C T U R E . —BRIAN FOOTE AND JOSEPH YODER M V C M V P M V V M Model View Controller Model View Presenter Model View ViewModel
  4. 4. W H Y C O D E I S I N B A D S H A P E W I T H O U T A R C H I T E C T U R E ? keep track of the logic  Unit Tests coverage difficult to debug Maintenance Scalability
  5. 5. M V C UI changes a lot more than logic desktop& web wanted separating UI functionality
  6. 6. Model View Controller Data Layer UI Layer Logic Layer handling network or database get notified of user's behavior and update model as needed
  7. 7. MVC
  8. 8. Point of MVC was to make Model testable So View & Controller was dependent on platform
  9. 9. P R O B L E M W I T H M V C ? Testability? difficult to unit test Modularity? model tightly coupled to views Maintenance? more&more code transfers to controller and get bloated
  10. 10. M V P BREAKS CONTROLLER
  11. 11. Model View Presenter Data Layer UI Layer Logic Layer handling network or database Controller from MVC without any reference to Android Activity/Fragment is part of view + layout.xml
  12. 12. MVP
  13. 13. MVP
  14. 14. M V V M ARCHITECTURE with DataBiding Easier Testing and Modularity Reduce Code to Connect View + Model
  15. 15. Model View ViewModel Data Layer UI Layer Logic Layer handling network or database Like Presenter in MVP but can't access View directly. Bind to Observable variables and action exposed by ViewModel
  16. 16. T H A N K S

×