You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just working on a similar architecture when I ran into this boilerplate. So far I think it's great and it completes a lot of the thoughts and inner dilemmas I was having.
One particular problem I keep running into comes down to what the responsibility of the ViewModel is. As in here, the architecture component ViewModel (presentation layer *1) is responsible for receiving Ui events and return Ui states. On the other hand, models from other layers get mapped to another kind of ViewModel (UI layer *2) which is only a representation of the data to be displayed.
In my project I'm using databinding and so I bind the UI layer ViewModel to list item layouts, for example. In the case of the whole screen, I bind the activity/fragment instead of the presentation layer ViewModel. But I know a colleague binds the layout directly to the presentation layer ViewModel and might have a RecyclerView adapter directly in the VM.
Would you agree with me that the two kinds of ViewModel I mention are different? Or do you consider them the same? If they are different, shouldn't we find a better naming for one of them?
The text was updated successfully, but these errors were encountered:
It's good to know you think of them them as two completely separate things. What are you going to name it then? In my opinion the "ViewModel" name for the data representation of a view makes sense.
Considering the blog post you wrote about data model mapping, it'd be reasonable to have an API Model, a Cache Model and ultimately a View Model. And so I would say that the ViewModel naming chosen for the architecture components is not really a great fit and should be renamed. I just can't find a name that clearly represents what it does.
I was just working on a similar architecture when I ran into this boilerplate. So far I think it's great and it completes a lot of the thoughts and inner dilemmas I was having.
One particular problem I keep running into comes down to what the responsibility of the ViewModel is. As in here, the architecture component ViewModel (presentation layer *1) is responsible for receiving Ui events and return Ui states. On the other hand, models from other layers get mapped to another kind of ViewModel (UI layer *2) which is only a representation of the data to be displayed.
In my project I'm using databinding and so I bind the UI layer ViewModel to list item layouts, for example. In the case of the whole screen, I bind the activity/fragment instead of the presentation layer ViewModel. But I know a colleague binds the layout directly to the presentation layer ViewModel and might have a RecyclerView adapter directly in the VM.
Would you agree with me that the two kinds of ViewModel I mention are different? Or do you consider them the same? If they are different, shouldn't we find a better naming for one of them?
The text was updated successfully, but these errors were encountered: