Are the advantages of Model-View-ViewModel (MVVM) pattern worth the overhead?

前端 未结 4 1434
执笔经年
执笔经年 2021-01-04 21:15

The question is stated in the subject: are the advantages of Model-View-ViewModel (MVVM) pattern worth the overhead?

In many cases, implementing the view model invo

4条回答
  •  失恋的感觉
    2021-01-04 21:45

    Why not extending the Model class, providing additional properties to make it easy to be consumed by the View instead?

    In the simple cases, this is all the ViewModel is doing - wrapping up the Model so that its extended in a way that's consumable by the View. If your Model can be bound directly, you're welcome to do so.

    That being said, there is more to the ViewModel layer than just wrapping the model - this is also where the application specific logic - ie: the application's plumbing, will occur. Something has to make the requests from the Model classes correctly and compose together the logic.

提交回复
热议问题