lundi 9 mai 2022

What is the difference between the ViewModel class and the Repository class?

Inside my application, There are more than 25 fragments and now it is very hard to add new features and fix bugs because reading the code became harder (I feel like I've lost control of the code)

I studied the MVVM pattern 1 week ago and I want to apply this pattern to all fragments, But I still don't understand the difference between the ViewModel class and the Repository class.

I know the ViewModel class can secure the precious data from external conditions but why I should create a Repository class? Why I don't put everything in the ViewModel class?

Please don't link me with external questions because I read everything

Explain like I'm five

Aucun commentaire:

Enregistrer un commentaire