際際滷

際際滷Share a Scribd company logo
A N D R O I D
A R C H I T E C T U R E S
MVC, MVP, MVVM
A B O U T M E
Majid Ramezanpour
majid.ramezanpour@gmail.com
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
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
M V C
UI changes a lot more than logic
desktop& web wanted separating UI
functionality
Model
View
Controller
Data Layer
UI Layer
Logic Layer
handling network or database
get notified of user's behavior
and update model as needed
MVC
Point of MVC was to make Model
testable
So
View & Controller
was dependent on platform
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
M V P
BREAKS CONTROLLER
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
MVP
MVP
M V V M
ARCHITECTURE
with DataBiding
Easier Testing and Modularity
Reduce Code to Connect View + Model
Android Architectures
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
Android Architectures
T H A N K S

More Related Content

Android Architectures

  • 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. A B O U T M E Majid Ramezanpour majid.ramezanpour@gmail.com
  • 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. 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. M V C UI changes a lot more than logic desktop& web wanted separating UI functionality
  • 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. MVC
  • 8. Point of MVC was to make Model testable So View & Controller was dependent on platform
  • 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. M V P BREAKS CONTROLLER
  • 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. MVP
  • 13. MVP
  • 14. M V V M ARCHITECTURE with DataBiding Easier Testing and Modularity Reduce Code to Connect View + Model
  • 16. 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
  • 18. T H A N K S