What is MVVM?
Model-View-ViewModel is an architecural approach used to abstract the state and behaviour of a view, which allows us to separate the development of the UI from the business logic. This is accomplished by the introduction of a ViewModel, whos responsibility is to expose the data objects of a model and handle any of the applications logic involved in the display of a view.
This approach (MVVM) is made up of three core components, each with it’s own distinct and separate role:
- Model – Data model containing business and validation logic
- View – Defines the structure, layout and appearance of a view on screen
- ViewModel – Acts a link between the View and Model, dealing with any view logic
Why Data binding you ask ?
If you have used Angular you already know what it is, but if you haven’t check this out
now no need to manually update UI
just by setting variable value changes are reflected.
a new support library has been added to utilize http://developer.android.com/tools/data-binding/guide.html
Though you can add logic to views but you shouldn’t just to keep the logic separated from views.(who in their sane mind would merge view and logic. (not me that’s for sure))
I am planning to write up another entry, an example on how to use these features.
PS: Still working on Hiragana.