Difference between MVC and MVVM.

Difference between MVC and MVVM.

MVC

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller.

Model?view?controller (MVC) is a software architectural pattern for implementing user interfaces on computers.View is a user interface. View displays data from the model to the user and also enables them to modify the data.Controllers are responsible for controlling the flow of the application execution. When you make a request (means request a page) to MVC application, a controller is responsible for returning the response to that request.

Image for postMVC

Advantage –

  • Support for asynchronous request: MVC also supports asynchronous technique, which helps developers to develop an application that loads very fast.
  • Modification does not affect the entire model: Modification does not affect the entire model because model part does not depend on the views part. Therefore, any changes in the Model will not affect the entire architecture.

Disadvantage-

  • Increased complexity

MVVM (Model View- ViewModel)

The Model-View-ViewModel pattern can be used on all XAML platforms. Its intent is to provide a clean separation of concerns between the user interface controls and their logic.

Image for postMMVM

Why It has been developed

  • To accomplish a natural pattern for XAML platforms. The key enablers of the MVVM pattern are the rich data bindin.
  • To provides separation of concerns.(it achieve S-0f solid pattern).
  • To allow, developer-designer workflow. When the UI XAML is not tightly coupled to the code-behind.
  • To increases application testability

Advantage

  • Components to be swapped
  • Internal implementation to be changed without affecting the others
  • Components to be worked on independently
  • Isolated unit testing

it work on observer pattern.

18