Difference between MVC1 and MVC2

What is MVC?
MVC is a design pattern and it is not technology. Using any technology we can implement MVC based Web application. Using MVC we are separating our web Application into different layers. The model contains only business logic. The view contains the Presentation related logic which is page design etc. The controller handles the Request coming from the client and Response coming from the Back end server. This is the objective of the MVC design pattern.

What is MVC1?

 

MVC1One decade ago we were using JSP and JSP connecting with Java classes. The Java classes contain Business logic and DB Operations. In the case of the MVC1 design pattern, the Model and views are tightly bound with each other. In the JSP Page itself, we use to call Java class using some JSP based tags.  In the MVC1 design pattern, the View layer and model layer mixed together so the code maintainability is very tough. The back-end and front-end developers high dependent on each other. They can’t work independently. The reusability of code is very less. This pattern is good if you want to design a small Web Applications like 10 pages or 20 pages site. Highly dynamic websites are not fit with the MVC1 design pattern. 

What is MVC2
MVC2 is a more neat and well design pattern when compare to MVC1. it is clearly separated from each other.
MVC2 architecture diagram

From the above diagram, we can understand that each layer is clearly separated. In the case of Spring Framework Client act as View i.e, it could be either JSP or any other view like thymeleaf etc The request send to Spring Boot Dispatcher servlet. This Servlet act as Controller. The Dispatcher Servlet designed based on the Front Controller design pattern to handle Request and Response. Once a request received from the client, the Dispatcher servlet sends the request to the appropriate Controller class. After processing the request, the back end System sends the response to the Dispatcher servlet. the Dispatcher servlet sends the response to the appropriate client view. In the MVC2 design pattern code, maintainability is very high i.e, we can maintain the code easily. We can change the code without affecting other layers. Front-end developers can work independently and back-end developers can work independently.


Please follow our ITGARDEN YouTube channel for Billing System Project development work using Spring Boot. The Project source code absolutely free. This project is very good for who is looking for real-time project experience in Spring Boot. To understand the Billing System Project code, watch all Billing System related YouTube videos from this link. Click Here
Our YouTube Channel
https://www.youtube.com/channel/UChj5CeuWaHIFr4RkXoG3iJA?view_as=subscriber
Please follow me on Medium.com for all billing system related stories and Java-based technical Articles
https://suresh-stalin.medium.com/

Close Menu
×
×

Cart