Posts on Design label.
In the previous MVVM-part1 we learnt about the data binding, how we can set data binding in android, which attributes can be bounded, and how do we can create auto-updating layouts.
In this part of the article series of MVVM we would learn how the MVVM model interact with its different components.
Model-View-Presenter (MVP) architecture is widely used in today’s Android apps to separate the view from the presentation logic and the model by introducing a presenter. Model-View-ViewModel (MVVM) is quite similar to MVP, with the view model acting as an enhanced presenter, using a data binder to keep the view model and the view in sync. By binding the view to view model properties, the data binder can handle view updates without the need to manually set changed data back to the view (e.g. no more
setVisibility() on a TextView). As with the presenter in MVP, the view model can easily be unit tested. This article gives an introduction to both the data binding library and the MVVM architectural pattern and how they work together on Android.
Model View Presenter(MVP) is similar to other structural patterns for implementing separation of concerns, such as Model-View-Controller and Model-View-ViewModel. In MVP on Android, your activities and fragments typically act as the view objects by implementing a view interface, and handle interaction of the app with the user.
The view passes on user actions to the presenter, which handles the business logic and interaction with data repositories, such as a server API or database. The model layer consists of the objects that make up the content of the app.
"Don’t grieve. Anything you lose comes round in another form."
"Let the beauty we love be what we do."