In keeping with their annual cadence, Microsoft has begun work on the next version of ASP.NET MVC. Areas of emphasis include smoothing out the development and deployment workflow, sharing more features with Web Forms, improving AJAX support, and offering a better story for HTML 5 on mobile and tablet devices.
Warning: The features mentioned in this article are still in the planning stage and may not necessarily appear in the final version of MVC 4.
Recipes
In terms of development speed, the lack of complex user controls has been quite detrimental to the framework. The MVC team is looking to offer a way get the same rapid development that Web Forms offers, but without the associated lack of control. One idea is the use of “recipes”. This is best explained using an example:
Say the developer wants a complex grid with client-side sorting. Under the Web Forms model the developer would choose a suitable grid-style user control. While some customization is allowed, for the most part they are stuck with whatever features comes with the control whether or not he actually wants them. When using a recipe under MVC, the developer would instead be given a dialog box where they indicate which features they desire. The recipe would then generate the necessary HTML and JavaScript, using libraries such as jQuery as necessary.
Another example of using a recipe is implementing OAuth-based authentication. Normally this requires changing code in several places, some of them non-obvious. In this case the recipe would add all the necessary code in the right places, greatly reducing the chance of a mistake leading to a runtime failure or security vulnerability.
Authoring your own recipes should not be too difficult. Essentially it is just a dialog which is given an instance of the EnvDTE.DTE interface. From there it would work like any other Visual Studio plug-in or macro. The framework would handle things like hosting the recipe in the right context menus.
Mobile Development
The first change to the mobile development story is improving the out-of-box style sheets so they look good on small screens. This isn’t a big deal for shops with professional designers who build CSS from scratch but smaller shops often rely on it as a starting point.
For those who want something more for their mobile customers there is the option for device specific views. Instead of using CSS and JavaScript to hide content that doesn’t fit comfortably on the screen developers can remove this entirely. This will immediately reduce the amount of bandwidth needed and may in turn result is faster rendering.
Performance Improvements
It is well known that using asynchronous techniques can greatly improve the maximum number of simultaneous clients on a single web server. Alas it is also well known that asynchronous techniques require an inelegant or downright clumsy series of callbacks.
Like Web Forms vNext, MVC will be getting support for the async/await keywords from C# 5 and VB 11. In the example below you can see how two asynchronous calls (presumably to a database) are in-lined with the constructor of the view-model.
Another performance enhancement is built-in CSS and JavaScript bundling. This is an important feature for high volume sites, as the sheer number of round trips to gather all the various bits of CSS and JavaScript can be quite significant. By combining the files into a single download, while at the same time removing comments and whitespace, rendering times should improve.