With the new ASP .NET MVC 3 release candidate ready to roll, it's time to look at where Microsoft has reached in its efforts to restart its web development technology.
Windows Phone 7 isn't the only area of technology in which Microsoft is attempting a restart. It may be a lower profile operation, but the switch from old style ASP .NET approaches and technologies to MVC, Razor-embedded code and Web Matrix easy-start, template-driven websites is just as much a change in direction.
Microsoft has released the ASP .NET MVC 3 Release Candidate, complete with new functionality - and you always thought that release candidates should be stable and not introduce new features.
The key new features are:
- IntelliSense for Razor syntax
- integration of the NuGet Package manager
- partial page output caching
- and a range of improvements to the IDE.
The move to an MVC framework, and the introduction of Razor in particular, can be seen as part of Microsoft's move away from doing things its own way to doing things in a way that other people seem to find effective. MVC is still the favored architecture implemented by open source projects such as Rails, Struts etc. and ASP .NET is late to the party with ASP .NET MVC. Even so there are many that think better late than never even if it does mean a "de-emphasis" on the traditional ASP .NET architecture. In particular MVC doesn't use the standard postback method of dealing with user interactions. Postback was a crazy idea designed to make web development look more like desktop development and proposed with the assumption that Internet connection speeds would improve to the point where the delay inherent in performing an entire page update would be negligible. Today we know better and Ajax - partial page update is the norm.
Razor on the other hand isn't quite such a clear cut change of direction. While it is sometimes described as new and innovative, it is just copying an existing and apparently successful approach to adding code to HTML. Razor allows programmers to more easily mix HTML and C# or VB using code "nuggets" embedded using tags and auto syntax recognition. In this it follows the way PHP programmers can create an HTML page with embedded PHP code.
In principle this makes it easier to create web pages and hence it is a good thing to introduce to ASP .NET. However, most experienced PHP programmers will tell you that the mixed HTML/PHP style of programming is to be avoided if at all possible because it creates sites with a poor architecture and makes it very difficult to understand what is going on. Razor may be easy but it really doesn't have a good theoretical underpinning.
However it is arguable that the reason PHP became so popular is that it made getting started easy. If you were creating HTML pages you could just add some PHP to the mix hardly without noticing. In the case of ASP .NET it isn't clear that Razor combined with all of its ancillary technology really is an easy entry. For this it all depends on Microsoft's other new packaging of web development in the form of Web Matrix. This gets beginners started with templates sites and then encourages them to use Razor syntax to customise them. Will Web Matrix be a stepping stone to more ASP .NET web sites? Who knows...
Download from:ASP.NET MVC 3 RC
New .NET tools in beta - NuPack, ASP .NET MVC 3, WebMatrix
Microsoft WebMarix and Razor
MVC - it's the routing stupid!
ASP.Net MVC in Action