What is MVC Architecture

What is MVC

What is MVC Architecture

Before, we proceed with spring MVC framework. It is very important to understand the concept of MVC pattern. In this tutorial, I will explain about MVC design pattern then we will quickly move to the Spring MVC framework. In simple term, MVC is a design pattern that separates business logic from presentation and helps us to develop things in component manner. MVC design pattern architecture separates application development into three parts which are Model, View and Controller.

Example

For better understanding, let’s take the example of restaurant to understand the concept of MVC. When you go to the restaurant, you order something to the Waiter. Waiter is actually a Controller which take requests from the users or Customers in restaurant. Waiter then takes the request and goes to the kitchen where all business logic is being applied to prepare what you requested. Chiefs are developing the things are applying some presentation and finally, forwarded to the waiter. Waiter who actually is controller comes back with the data which is your food with better presentation and served to you. And what you see on your table is View.

Model

Model layer is responsible to handle business logic or complex calculations like fetching records of users, searching for particular record etc. Model only perform business logic, it does not perform any presentation related work for you.

View

View is simply presentation layer. Simply you can say, view is a User Interface. View is actually what you see on the screen. All presentation related things are done by View layer like developing HTML, CSS for user interface, applying some JQuery or AngularJS. You develop the things which will be visible to the user.

Controller

Controller is basically is request and response handler. It does nothing but handling requests from the users and provide them response what it gets from Model. Or you can say, it stays in the middle of View and Controller. Which take inputs from the View.  
What is MVC
What is MVC

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *