2 ms·
A backend model is usually just called the model as it’s modeling the data domain (sometimes called ‘domain model’). The thing you pass to the frontend is the ‘
by sroussey 3y ago
A backend model is usually just called the model as it’s modeling the data domain (sometimes called ‘domain model’). The thing you pass to the frontend is the ‘view model’ which is often entirely different.
In some CRUD situations though, they can be nearly the same and you can convert the domain model into a specific view model with some kind of adapter (how people do this varies a lot). This adapter will take the end user security level into account, for example. Also, to avoid sending lots of useless data for a list, you can have a list view model. But if you do that, be sure to either keep the two in sync, or you have one and keep track of whether it’s partially or fully hydrated.
- jmilloy 3y agoI agree that mvvc sounds exactly right, but there is still the question of whether the view model is created in the back end (which is what the article is advocating) or in the front end (which is what you have to do if the back end serves the model like a general use API). The MVC or mvvc or whatever paradigm is somewhat orthogonal to the technical back end/front end.