Republic day celebration is a huge national event celebration in India especially for students in the schools, colleges and other educational institutions. Variety of activities are run by the teachers…
Month: January 2018
Model-view-controller is a software architectural pattern, which divides a given application into three separate parts. It is basically build to avoid mixing code from the three categories into one class. MVC is one of the most frequently used industry-standard web development framework to create scalable and extensible projects.
In a typical application you will find these three fundamental parts:
- Data (Model)
- An interface to view and modify the data (View)
- Operations that can be performed on the data (Controller)
Architecture of MVC:
Components of MVC:
Following are the components of MVC:
1.Model: Model is responsible for managing the data of the application, such as the data, logic and the rules of the application. The model does NOT depend on the controller or the view. It responds to the request from the view and it also responds to instructions from the controller to update itself.
Model classes can either be created manually or generated from database entities. It is the model that responds to requests coming from the view regarding its status or state. In this way, the processing of data takes place only in the model, which ensures internal data consistency.
The view is also used to present the graphical visualization of the user interface. It could filter out some aspects of the model or highlight others. It represents the input and output data in an interface using various elements such as pushbuttons, menus, dialog boxes, etc. To see the status of the application objects, the view queries the model through the controller.
3.Controller: The controller is responsible for all the interactions between the model and view. It also responsible for dispatching requests and controlling application flow.
The controller uses the model methods to retrieve information about the application object, to change the status of the object and to inform the view about this change. In a sense the controller enables a user to make changes and see results
Advantages of MVC:
- Faster Development Process:
MVC supports rapid and parallel development. If an MVC model is used to develop any particular web application then it is possible that one programmer can work on the view while another can work on the controller to create business logic of the web application. Hence this way, the application developed using MVC model can be completed three times faster than applications that are developed using other development pattern.
- Ability to provide multiple views:
In the MVC Model, you can create multiple views for a model. Today, there is an increasing demand for new ways to access your application and for that MVC development is certainly a great solution. Moreover, in this method, Code duplication is very limited because it separates data and business logic from the display
- Modification does not affect the entire model:
For any web application, user interface tends to change more frequently than even the business rules of the company. It is obvious that you make frequent changes in your web application like changing colors, fonts, screen layouts, and adding new device support for mobile phones or tablets. Moreover, adding new type of views are very easy in MVC pattern because the Model part does not depend on the views part. Therefore, any changes in the Model will not affect the entire architecture.
- SEO friendly Development platform:
Disadvantages of MVC:
- The framework navigation can be complex because it introduces new layers of abstraction and requires users to adapt to the decomposition criteria of MVC.
- Knowledge on multiple technologies becomes the norm. Developers using MVC need to be skilled in multiple technologies.
- MVC needs multiple programmers.
Thus, MVC design pattern is a surely the great approach to building software applications. The MVC framework is easy to implement as it offers above given numerous advantages. Projects that are developed with the help of MVC model can be easily developed with lesser expenditure and within less time too. Above all, its power to manage multiple views makes MVC the best architecture pattern for developing web applications.