October 25, 2024 08:58 by
Peter
Model View Controller, or MVC for short, is a design pattern used to create applications rather than a programming language. Three components will make up the application that was created utilizing the MVC design pattern. Which model will house all of the data that can be retrieved at the user's request?
The Controller will have business logic code, and the View will have user interface code. We shall examine a graphical example of MVC to gain a better understanding of it.
The Properties of MVC is.
- Loose Coupling
- Lightweight code
- Effective look
- Testing is Very Easy
- Rapid application integrated development.
MVC Architecture
The architecture of MVC can be seen in the following figure.
Explanation
User will make request for the page which user would like to retrieve. Requested page will go to controller and on controller Route.Config will be checked. Requested page will get transfer to Model from Controller.
On Model there will be 2 steps.
- Page initialization will get started.
- Then result set will be generated.
After these operation result set will get unload to View through view engine.
Responsibility of view engine
- View Engine get the request from Controller
- The requested page will get executed
- The result got by the execution process will get deliver to View.
Life cycle of MVC
Life Cycle of MVC is in the following figure.
Explanation of MVC Life Cycle
Step 1. User will make request for page
Step 2. Route.Config will get check on Controller
Step 3. After Route.Config validation request will get transfer from Controller to Model
Step 4. Page request will go to Model & on Model the following operation will perform.
- Page initialization will start after the initialization of the page.
- One result set will get generated.
Step 5. Generated result set will be delivered to the Controller from the Model.
On Model Page validation operation will perform.
Step 6. After page validation on controller, Page will deliver to View through View engine.
Step 7. Now user can see requested page as response page.
Life Cycle of MVC can be seen as in the following figure.
Explanation
- User will make page request.
- Route.Config of requested page will get checked on Controller.
- Page initialization will be performing on Model and after page initialization one result set will get generated.
- Generated Result set will be getting delivered to the Controller from Model.
- Result set will get validated (Page Validation) and after page validation Result set will get delivred to View through view engine.
Recap
MVC Stands for Model View Controller, which is a design pattern. MVC based developed application will get divided in 3 components. Each and every component will contain their own code only.