MVVM Architecture

BINESH T J
1 min readFeb 20, 2019

--

A design pattern is a solution to a problem in context. MVVM is a design pattern which stands for Model-View-ViewModel.

Model: Data structure for the data being handled.

View: Visual representation of the data which the user sees.

ViewModel: It fetches (& converts if needed) the data in the Model that can be presented in the View.

WHO Presents the the data to the user?

In the case of mobile apps, in iOS it’s the ViewController and in Android it’s the Activity or Fragment. That is, the ViewModel gets data from the Model, converts it into a user-friendly form (or keeps it as it is, depending on the application) and passes it to the View, via the ViewController.

Generically, the ViewModel takes the data from the Model and gives to the View.

WHY use MVVM?

Makes the code modular and separates business logic with UI related stuff, hence improved maintainability and the ability to test.

BOTTOMLINE

It depends on the application and the programmer to choose the architecture. MVVM is not necessarily better always.

--

--