MVC Framework is a software architecture used in software engineering. Model View Controller (MVC) pattern creates applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.
The model manages the behaviour and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller). In event-driven systems, the model notifies observers (usually views) when the information changes so that they can react.
The view renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. A view port typically has a one to one correspondence with a display surface and knows how to render to it.
The controller receives user input and initiates a response by making calls on model objects. A controller accepts input from the user and instructs the model and a view port to perform actions based on that input.
An MVC application may be a collection of model/view/controller triads, each responsible for a different UI element. The Swing GUI system, for example, models almost all interface components as individual MVC systems.
Though MVC comes in different flavors, control flow is generally as follows:
The user interacts with the user interface in some way (i.e. View).
The controller handles the input event from the user interface, often via a registered handler or callback, and converts the event into an appropriate user action, understandable for the model.
The controller notifies the model of the user action, possibly resulting in a change in the model’s state. (For example, the controller updates the user’s shopping cart).
A view queries the model in order to generate an appropriate user interface (for example the view lists the shopping cart’s contents). The view gets its own data from the model. In some implementations, the controller may issue a general instructio n to the view to render itself. In others, the view is automatically notified by the model of changes in state (Observer) that require a screen update.
The user interface waits for further user interactions, which restarts the control flow cycle.
Some of the famous MVC Framework implementations in different language:-
Ruby on Rails
Leave a Reply