MVC Architecture has implemented by Trygve Reenskaug at 1979 for the first time. It was implemented on Smalltalk at Xerox labs. Then benefits and advantages of this architecture has been accepted by most of the coders and software engineers.It was an information about MVC’s history above. Now lets talk about what really MVC is. The word M stands for Model, V stands for View and C stands for Controller. I am going to mention about each item.
The figure above may help you while thinking what structure it might have.
It handles data processing and database works part. Model processes events sent by controller. After processing these events then it sends processed data to controller (thus, controller may reprocess it) or directly to view side.
View prepares an interface to show to the user. Controller or model tells view what to show to the user. Also view handles requests from user and informs controller.
Let’s say controller is like brain of the system. That is right. Because it processes every request, prepares other parts of the system like model and view. Then the system determines what to do by controller’s commands.Even if you are junior developer you probably faced with a problem called “Complexity of Project”. There MVC comes. MVC helps you to decrease complexity of project. For instance, there is a team with 5 people. If they are working on same project after sometime project reaches a point which no one cannot understand what is project going to be. What i mean is MVC splits project to (by default) three different parts. Like Model, View, Controller.You can say;
As you see above if you split your project three part like Application Development, Database and Data processing and Interface development then of course you project will be more understandable and developers can work more efficiently.
Advantages of MVC:
MVC is perfect for team work. As i mention before this architecture splits your project into some parts so, team members can work and their parts without any dependency. Then you will realize that MVC makes your project more systematic.
It is really easy to edit or change some part of your project that makes less development cost and maintenance cost.
MVC doesn’t repeats itself. If you wrote some script for your project. Because of non-dependancy property of MVC then you may use this script for another project of yours. And of course it helps you to finish your project by spending less time then others.
Features Of MVC 4.0:
- ASP.NET Web API: This is a new framework for building and consuming HTTP services (web APIs) that can reach a broad range of clients including browsers and mobile devices. ASP.NET Web API is also a great platform for building RESTful services.
- Enhanced default project templates: The ASP.NET MVC 4 project templates have been updated to create a more modern-looking website and to support adaptive rendering for mobile devices. The template uses HTML 5 markup by default. All template features are installed using NuGet packages so that you can easily get the latest updates.
- Mobile project template: If you’re starting a new project and want to create a site specifically for mobile and tablet browsers, you can use the new Mobile Application project template. This is based on jQuery Mobile, an open-source library for building touch-optimized UI.
- Display modes: The new display modes feature lets an MVC application select views depending on the browser that’s making the request. Layouts and partial views can also be overridden for particular browser types.
- Browser overriding: You can also use browser overriding to treat requests as if they are coming from a different browser. We published to NuGet a prototype view switcher based on this functionality in the jQuery.Mobile.Mvc package.Task-based async support: You can now write asynchronous action methods for any controller as single methods that return an object of type Task or Task<ActionResult>.
- Bundling and Minification: The bundling and minification framework enables you to reduce the number of HTTP requests that a Web page needs to make by combining individual files into a single, bundled file for scripts and CSS. It can then reduce the overall size of those requests by minifying the contents of the bundle. Minifying can include activities like eliminating whitespace to shortening variable names to even collapsing CSS selectors based on their semantics. Bundles are declared and configured in code and are easily referenced in views via helper methods which can generate either a single link to the bundle or, when debugging, multiple links to the individual contents of the bundle.
- Improved link generation: ASP.NET MVC 4 includes the latest Razor view engine. This includes better support for resolving URL references using tilde (
~/) syntax and support for conditional HTML attributes.
- Seamless deployment to Azure: ASP.NET MVC 4 supports Windows Azure SDK for .NET. All MVC project templates are now set up to bin-deploy all assembly references in order to simplify deployment. The templates also use the new ASP.NET Universal Providers that extend session, membership, roles, and profile support to SQL Compact Edition and SQL Azure.
- Recipes: Recipes are a way to deliver tooling via NuGet packages in order to automate a task within a project. For example, recipes can be used to replace the existing Add Area, Add Controller, and Add View dialog boxes. Recipes can also add completely new functionality.
- Database Migrations: ASP.NET MVC 4 projects now include Entity Framework 5.0 RC. One of the great features in Entity Framework 5.0 is support for database migrations. This feature enables you to easily evolve your database schema using a code-focused migration while preserving the data in the database.
- Empty Project Template:The MVC Empty project template is now truly empty so that you can start from a completely clean slate. The earlier version of the Empty project template has been renamed to Basic.
- Json.NET for JSON formatting: The default JSON formatter in ASP.NET Web API now uses Json.NET for JSON serialization. Json.NET provides the flexibility and performance required for a modern web framework.
- HttpMessageInvoker: The HttpMessageInvoker provides a light weight mechanism to invoke an HttpMessageHandler without the overhead of using HttpClient. Use HttpMessageInvoker for unit testing message handlers and also for invoking message handlers on the server.
- Response buffering improvements: When web-hosting a web API the response content length is now set intelligently so that responses are not always chunked. Buffering also enables reasonable error messages to be returned when exceptions occur in formatters.t testing message handlers and also for invoking message handlers on the server.
- Monitoring and diagnostics: You can enable tracing by providing an ITraceWriter implementation and configuring it as a service using the dependency resolver. The ILoggerinterface has been removed.
- Create custom help and test pages: You now can easily build custom help and test pages for your web APIs by using the new IApiExplorer service to get a complete runtime description of your web APIs.
- Entity Framework 5.0 RC: ASP.NET MVC 4 projects now include Entity Framework 5.0 RC.