MVVM(Model View ViewModel)

from the CommonsWare Community archives

At April 4, 2019, 4:21pm, Pvr asked:

helloo…
How do i use MVVM in my Android Project (how to apply),
I have Theoretical knowledge on MVVM but Dont know how to implement
Help me out…


At April 4, 2019, 4:35pm, mmurphy replied:

I am not a GUI architecture expert, and I do not feel confident that however I would describe MVVM in Android actually is MVVM.

There are plenty of blog posts on the subject:


At May 21, 2019, 6:31pm, ivano_trocchietto replied:

I learned MVVM after I got hired and worked at a real life app
As I infer from Mark, android architecture components are based on MVVM.

My humble suggestion are:
1)Work on a real project in github
2) Try to make grow your own app, and if you get stuck ask to stack overflow. But ask to your coding friends to have a look at your code,r eviews make you grow tremendously, btw you can get reviews with point 1
3) Be aware that speaking about architecture is like speaking about politics, you will get republicans that speak bad of democrats, and democrats that see the same event as bad because of the repubblicans
4) If you get familiar with design patterns, SOLID principles clean architecture, and imperative vs reactive/functional coding you will understand what works better as architecture for every project based on common sense
5) Play with the Mark libraries, trying to make them mvp and mvvm, and in particular his todo notes book
6) Have fun, because coding is playing with your own toy project. but just learn the basics of git so that you can mess around.
7) Ask to stackengineer. there are a lot of architecture fanatics that will help you about small doubts.
8) Databinding, livedata and rx are your friend with mvvm. A golden rule, test your ViewModel, try to make your activities fragments empty and put all the stuff in mvvm, so that you can junit. Learn Martin Fowler repository pattern.