Modern web applications are often built with the MVC pattern, for the backend. What about the frontend? Frameworks such as Backbone.js
leave a lot of boilerplate code to be written. This becomes apparent for large projects. The library is lightweight, but lacks strong abstractions. It leaves the task of loading data from the server and DOM manipulation to the developer.
With the ModelViewViewModel (MVVM) pattern, the application logic is encapsulated in a set of ViewModel classes that expose an object model that is View-friendly. Views rely on bindings to observables to be notified of changes in the ViewModel. As a result, the UI refreshes automatically with the data when using the MVVM pattern. The flow of data in the MVVM pattern is illustrated in this diagram:
From a software design point of view, the MVVM pattern has the benefit of testability, separation of concerns, and reusability. The ViewModel doesn't contain any user interface elements, making it easy to test...