MVC stands for Model View Controller. It is a software design pattern for developing web applications.It separates an application into three main logical components: the model, the view, and the controller.
Each of these components are built to handle specific development aspects of an application.
Model View Controller Architecture |
Model:
The lowest level of the pattern which is responsible for maintaining data.The Model component corresponds to all the data-related logic that the user works with.
This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data
For example:
A Customer object will retrieve the customer information from the database, manipulate it and update it data back to the database or use it to render data.
- Model layer is the data layer.
- It consists of all the data of our web application.
- The model layer is responsible to connect with the database as well as store the data into the database.
- It consists of all the classes in our web application which have the connection to the database.
View :
This is responsible for displaying all or a portion of the data to the user.The View component is used for all the UI logic of the application.
For example:
The Customer view will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with.
- It represents the presentation layer.
- It normally represents the user interface(UI) of the application.
- We can use HTML, CSS, and JS(javascript) etc to create the presentation layer.
Controller:
Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output.
For example:
The Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data.
- It is an interface between the view layer and the model layer.
- It receives the request from the view layer.
- It read the data which is coming from the presentation layer.
Popular MVC Frameworks:
If you think this topic give the help you needed,then share it and expand the knowledge.
You can also follow my Facebook page where you get information about more tools regarding programming and web development on daily basis.
Stay tuned soon i will list out best Frameworks of different programming language for different purpose(Game development/GUI development/Web Development etc).
No Comment! Be the first one.