• MVVM is the MVC Ccontroller and MVP Presenter into ViewModel, namely Model+View+ViewModel structure.

View is the display layer, on behalf of the UI component, it is responsible for the data model into THE UI display, representing the HTML display page; Model is the data layer, which represents the processing of data. You can also define the business logic of data modification and operation in Model, such as increase, delete, change difference. ViewModel is the business logic layer, used to monitor the data on both sides, representing all JS visual business logic. If the display layer is updated, the ViewModel will synchronize the data to the data layer. On the contrary, if the data layer changes, the ViewModel will update the data to the display layer.

  • Advantages of MVVM:
  1. The Controller is clean and concise because the ViewModel separates most of the Ccontroller code, making it cleaner and easier to maintain
  2. Easy testing: Most of the bugs in development come from logic processing, and since the ViewModel separates a lot of logic, unit tests can be constructed on the ViewMode
  3. Development decoupling (e.g., one person for logic implementation, one person for UI implementation)

Part of this articlereference