Novice to MVC: Read this
This article is meant for beginners of the Model-View-Controller (MVC) pattern (do not be confused with ASP.NET MVC; if you want to learn ASP.NET MVC, then please read this article). If you're a novice in this framework, then this article will surely help you. I will cover most of the parts of the MVC framework and will also explain how to implement this framework in your applications.
Understanding the Model-View-Controller
If you have already developed a few applications in the OOP model, then it would be easier for you to understand. Otherwise, you may have some tough time understanding this MVC pattern. But, don't worry, you will easily synchronize as we move further.
First of all, do not think of any other programming model or framework. Also, (as mentioned earlier) do not confuse MVC with ASP.NET MVC. This pattern is very common among other patterns of software architecture. MVC is just a term used to develop the software in a pattern such that it is divided into the following three sub-categories.
- Model: the data source for your application.
- View: your application's views, in other words the Graphical User Interface (GUI).
- Controller: Controller is the actual background logic for your application.
These were the three categories in which code is distributed efficiently. I will explain in further sections how application programming can be made simpler. Let us first explain the concepts of MVC, then I will walk you through the implementation of MVC in various programming languages and frameworks.
Diving into MVC
Let us first consider MVC as our subject of discussion. How can we use it and what is it actually? MVC is just a framework, architecture or a pattern, whatsoever you want to call it. It is just the model for your software development process that is targeted to maintain your source code and data sources. Also, this framework is targeted to reduce ambiguity and complexity found in enterprise software. Usually, when an application reaches an enterprise level of complexity, it is much harder to debug it.
Now, let us dissect the MVC into the following three sections and study it thoroughly.
Model
The Model is the part of the architecture that focuses on the data of the application. Your data may come through the following given methods:
- Database
- Reports
- Data sources such as files; JSON is a major example
- User input
These compose the model section for your application. The Model is responsible for updating the user interfaces and indicating a trigger to an event (if any) in the application to demonstrate that the data has now changed. Usually, these are just fancy names given to a simple model of the data. In most programming languages it can be a simple class, with a few members (trailing the properties or the attributes in the database table for the object) and a few functions to store the data in the data source and extract it. This must be kept secure and away from user interactions. Keeping it separate would help in minimizing unauthorized access attempts.
Note: The function part can also be implemented inside the controller to save the data or extract it.
View
The View is the user-interface part of the software application. All of the interface designs, such as buttons, input fields and so on, are to be added to this category. In most applications (such as web applications), HTML pages are the View whereas in other applications and frameworks other methods are used to create an interface, such as XAML files in WPF applications.
The main purpose of having a view is to get the data from the model and represent it to the user. All of the styles and other UI and UX techniques must be applied here. Views are usually called by the the controllers and returned to the users as a response after being filled up by the data from a model.
Controller
Getting to the most important part of this framework, the Controller is the actual software logic running underground. It is mostly composed of functions that your application runs, other underlying logical code for the users and such other code that must run throughout the initial stage to the very last line when the application ends.
- A request is made.
- The Controller handles the request.
- The URL is read and then appropriate functions are triggered.
- Inside those functions, the Model is asked for data and the data is placed into the view.
- The View is then returned as a response.
The overall framework is something like the following image.
The user must be allowed to interact with the Model himself but instead a Controller must be used to connect to the Model to get the data for the user's View that would be shown to him.
As I have said earlier, the user must not be allowed to interact with the Model. The user must be provided with the required tools and buttons on the view. The View can interact with the Controller to download data (if required). This is the MVC pattern of software development. Now, in the next section, I will provide you with other helpful resources that you might find helpful.
Other material
I will provide other tools and materials for developers in a specific framework or language.
Any framework or type
This section is meant for everyone. If you're developing an application and want to implement the MVC pattern then read this section and you will understand how to develop it in your own application development process.

Aruljothy SundaramoorthyPosted Mar 22, 2017, 11:37 AM
Hello sir i`m having a mini project in advanced java programming can you please help me how to do the code segments using MVC pattern for blood bank management system
Nitesh KejriwalPosted Dec 16, 2015, 8:17 AM
Nice read!
Sibeesh VenuPosted May 15, 2015, 7:54 AM
Informative
Afzaal Ahmad ZeeshanPosted May 15, 2015, 7:22 AM
Thank you very much for your kind words, Abhishek :) Jaiswal.
Nanhe SiddiquePosted May 15, 2015, 3:26 AM
nice
Abhishek JaiswalPosted May 15, 2015, 1:45 AM
The best thing about this article is it's language. Very well explained. Keep it up buddy!! :)
NitinPosted May 14, 2015, 12:49 PM
nice
Santhakumar MunuswamyPosted May 13, 2015, 4:17 PM
Thanks for nice article