Welcome to ASP.NET MVC
If you are new to this technology then you have to know about MVC first that what MVC is? It is architectural pattern which is used in software engineering. Why we need this pattern? Yes, the answer is that we need separation of concerns, we need isolation between the user interface and application logic.
In the process of software development in our case suppose web based application, we divide the responsibilities to teams to build the software product. Let’s assign the tasks; we give the html code to user interface designers and application logic to programmers.
In the following figure-1 we give views to designers, controller and model to programmers. If you are superb to do work in both than you can take all the responsibilities on your shoulder, but if project would be a large in scope and lines of code, it would be better to work in a team. Now we can focus on separation of concerns.
Model: Manages the behavior and state of application which directly maps the database table entries.
Views: Accepts information from controller and displays the data for the user, View use model to get information from and send to controller.
Controller: Receive the request and instruct to model to operate on the input and view to show the output. Basically it manages the control-flow of request and maps the request to required action, which in turns uses the model and passes that model to view to render the required data with great ease.
ASP.NET MVC implements the MVC pattern to achieve the goal with intuitive manner. Well it is the time to understand that how it is useful to design the web applications. It is the part of ASP.NET web application framework but has its own identity, because it uses different way to process the request.
ASP.NET MVC uses all the core features of web application framework like, http modules, handlers, caching, sessions, profiles, membership but provide an opportunity to work with great enhancements like routing, html helper methods, more than one view engines like aspx and razor.
We can use the ASP.NET MVC for;
- Easy to learn
- Better control over html markup and code pages
- Allows us to create user friendly and SEO friendly URLs
- JQuery and Microsoft Ajax is built in to develop rich internet application
- Minimize the dependency using Dependency Injection
- We can test our controller using unit test