You are not logged in.
Pages: 1
Reading the documentation, it talks about MVC and MVVM
Implementing MVC with mORMot services seems clear
But... MVVM? As I understand it, MVVM is heavily based on binding properties from the View to the VM. That means any change on a View property must be transferred to the VM. And also de opposite: any change on the VM must be transferred to the View
I can not see how it can be done
Is there any example somewhere?
Thanks
Offline
@ab ?
Is for real the MVVM in the documentation, or a typo?
Offline
The ViewModel is the Controller of mORMotMVC.pas.
In practice, the difference between MVC and MVVM is more about marketing and actual implementation details than a real design disruption.
Both MVC and MVVM are meant to separate the Model and View, using a third item, which is called a Controller or a ViewModel.
MVVM is a way of implementing MVC.
In mORMotMVC.pas, this VM/C is in fact an interface type, which defines the interaction between the model and the view.
Changes between the View and the VM/C interface is just to be reflected by changing the output parameters of its methods. Pretty simple.
Offline
the difference between MVC and MVVM is more about marketing and actual implementation details than a real design disruption.
I don't understand
IMHO, MVVM is not the same as MVC; for what I'm learning, MVVM gives a bigger decoupling than MVC: The VM should know nothing about the View. The view should be linked to the VM only through property binding and parameterless actions
I believe that the difference exists; MVVM might have started from MVC or MVP, but they are not the same
Could you please help me a bit more, to understand how to use MVVM with mORMot?
Offline
In mORMot, you can see the interface and implementation class defining the Controller as the application ViewModel.
The VM doesn't know anything about the View, which may be a Mustache template, another service, or just JSON. It just outputs some information which will be rendered by the View.
Offline
But the problem is the input... In MVVM, the view is bound to properties on the VM, and that binding must be bidirectional, unless it's just a report or something as that, wich is not the MVVM target
The view is expected to be codeless or as near to it as possible, and to alter the VM just through binding (and actions to a lesser degree)
Offline
Pages: 1