Slide 11
Slide 11 text
MVVM
Model-View-View Model
Model
Storage,
Networking, etc.
View(Controller)
Layout and
Presentation Logic
ViewModel
Business Logic -
Prepares data for
presentation
Services
UI Events
Updates
Request
Response
MVC Issues MVVM Resolution
Highly Coupled View highly separated from logic and data; Logic and UI can
be reused
Easily breaks SRP Each piece has a relatively single responsibility
Not easily testable
ViewModel is easily testable since it transforms inputs to
outputs
Easily achieves thousands of LoC Separation into files reduces chances of thousand-lines files
Massive View Controller View Controller only performs layout, so it is quite light.
ViewModel can be quite heavy but not as heavy as MVC
Higher separation of concerns. ViewModel processes UI
events to give the UI what it needs to present, via the
Model/Service layer.