Android Development and MVVM architecture

What is MVVM architecture ?

First, let’s talk about what the MVVM pattern is. The MVVM pattern is a pattern derived from the MVP pattern defined by Martin Fowler in the 1990s. The MVVM (Model-View-ViewModel) pattern helps to completely separate the business and presentation logic from the UI, and the business logic and UI can be clearly separated for easier testing and easier maintenance. Let’s take a look at View, ViewModel and Model

View

View is responsible for the layout structure displayed on the screen. You can also execute UI logic.

ViewModel

The ViewModel implements the data and commands connected to the View to notify the View of state changes via change notification events. Then, the View that receives the state change notification determines whether to apply the change. The ViewModel here is different from the ViewModel of AAC (Android Architecture Component). The ViewModel in AAC is a class that knows the Lifecycle to hold the data used by the View in changes like screen rotation. If you want to use the MVVM pattern while developing Android, you can implement it without using AAC ViewModel.

⛰ Architecture

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store