To elaborate; there are generally 3 components constituting any application, be it mobile, web-based or desktop applications. The Controller, the View and the Model are these 3 web applications. Each of the 3 applications has separate functions in an application and in the next couple of paragraphs we will find out about them.
The Controller acts as the traffic guard directing the traffic to its destination, finding out the view that needs to be loaded up and also interacting with the specific models within an application.If you wish to perform any activity on the website by choosing an option, the Controller will direct the application to load that page for your operation. It controls the model that handles specific commands.Hence, the Controller is the first one to help you in accessing the relevant information you want. After this stage is passed and you reach the second stage, the next controller handles the instructions.
The View in a web based application performs tasks similar to its name. It is actually the user interface on which the buttons are displayed, also displayed is information and forms.Precisely, the controller informs the View after it interacts with the model to gather and display the required information on the particular view.
The Model or the 3rd segment is the data storage for controller and view. It is the place where data is stored, retrieved, passed into and manipulated. If we take an example of a user trying to access his/her email account with the help of username and password, then the model takes the password and username from the controller, verify the data with the one stored in database and display the view accordingly. Now if the user has typed in wrong information, then the controller informs the view to display an error message.
Now the importance of MVC lies in the fact that it helps in easy maintenance of codes and simplifies debugging. It is capable of doing this by dividing the components into separate pieces instead of retaining a massive chunk of codes making it difficult for the programmer to control the program.It is easy to detect problems and find out remedies to them with separate sets. Whenever there is a trouble in the function of the application, the programmer knows where to look for it and get the remedy.
Thus, using this pattern for development allows the programmers to maintain the program easily.
It also allows independent development of components of the same system by multiple programmers. This makes the turnover of applications quick and easy without compromising on the standard of quality of the application.