erikjhordan-rey / People-MVVM

Sample created to practice MVVM and DataBinding in Android Applications.
https://erikjhordan-rey.github.io/blog/2015/12/15/ANDROID-databinding-android.html
668 stars 193 forks source link

A doubt regarding handling of Model in MVVM #27

Closed NabilLe123 closed 5 years ago

NabilLe123 commented 6 years ago

According to explanation of MVVM at different websites, a Model in MVVM is the one that should be used for business logic. But fetchPeopleList() is essentially a business logic and its called inside a Viewmodel (PeopleViewModel.java) rather than in a Model.

Why is it so? Doesn't this disagree with the MVVM architecture?

** Sorry if I am wrong!!

erikjhordan-rey commented 5 years ago

Conceptually the Model means "data" but according to the pattern or layers used in your system, the business logic will live in Use Case/Interactor, or Repositories or ViewModel (which will be a little weird because these classes have different responsibilities )if you're not using a domain layer.

In my defense, I did this sample when I was learning about MVVM but on these time arch components didn't exist, clean architecture and all this beautiful stuffs were borning, now you can find a lot of ways to split your architecture into different layers but the most important thing to remember is split data from UI.

Thanks for asking me!