A model view controller is known as MVC
- Invented by Smalltalk programmers.
- Web development framework for scalable and extensible projects
- Used for desktop GUI’s
- An adapted architectural framework for all programming languages
- design pattern inserts a controller class between view and model to remove model-view
- It makes new features convenient
- A single or structure of objects
- It depends neither on the controller nor the view
A Model represents knowledge. It could be a single object or a Structure of objects.
There should be a one-to-one correspondence between the Model and its parts on one hand. On the other hand. the correspondence should be between the Model and the represented world as perceived by the owner of the Model.
Functions of the Model are given as follows:
• This component corresponds to all the data related logic that the user works with.
• The Model can represent the data that is being transferred between the View and Controller components and also any other business-related logical data.
- A View is the visual representation of its Model.
- It would usually highlight certain attributes of the model and suppress others.
- It acts as a presentation filter.
A View is attached to its model (or a part of the Model). and gets the data necessary for the presentation by asking questions to the model. It may also update the model by sending appropriate messages All these questions and messages have to be in the terminology of be Model
The View will, therefore, have to know the semantics of the attributes of the model it represents.
This Component is used for all the logic of the application
- A Controller is a link between a user and the system.
- It provides inputs to the use by arranging for relevant views to present themselves in appropriate places on the screen.
- It provides means to the output by presenting the user with menus or other means of giving commands and data
The Controller receives the output. translates into the appropriate messages and passes these messages on to one or more of the Views. The Controller acts as an interface between the Model and the View to process all the business logic and incoming requests. It manipulates data using the Model component and interacts with the Views to render the final output
Interaction Between the Components
In addition, the application divides into three kinds of components. the MVC design defines the interaction between them The is how the interaction takes place
- The Model stores data. which a retrieved according to the Commands from the Controller and displayed in the View
- The View generates new output to the user based on all changes in the Model.
- The Controller sends commands to the Model to update the Model’s state (for e.g. editing a document) It can also send commands to its view to change the view’s presentation of the Model.
The basic differences between Basic Web and MVC Web Architecture
Basic Web architecture:
In a basic web architecture. the browser interacts with the web page and there is a web server sitting between. However, it gives a simplified view. also the web page might have a lot of codes to make decisions for us. the web page. finally sends the output back to the browser and it might even Interact with the database if it is enabled
MVC Web Architecture :