MODEL-VIEW-CONTROLLER (MVC) ARCHITECTURE

Course- Javascript >

The concept of the Model-View-Controller (MVC) software architecture is fairly simple: to separate our application into units, each of which conforms to one of the following parts.

Models

Models represent the part of the application dealing with business data and business logic. A model might be a single object, or it could be some structure made up from a variety of objects.

Views

A view is a representation of a model used to present information to the user. It usually acts as a presentation filter, showing only certain aspects of the data contained in a model while suppressing others.

A view interrogates its model to obtain the data necessary for presentation. It might also change the data in the model by sending appropriate commands. Such questions and commands all have to be in semantics defined within the model.

Controllers

A controller forms the link between the user and the application, arranging for views to be displayed on the screen, or reading user input by presenting menus, input fields, buttons, or other page elements. The controller interprets user input before passing it to one or more of the views

The operation of the various parts of the MVC framework is shown in snapshot.

Model-View-Controller framework interactions A readl World Example

Watching TV can be analogous to an MVC framework.

Watching TV can be analogous to an MVC framework.

The view is provided by the TV’s screen.

You can interact with the TV by using the functions of the remote control(ler).