A Blog

My Beef with Razor

July 28, 2010

(Note, for non-programmers, this is not about shaving)

ASP.NET MVC has shipped the first preview of version 3. This is a good thing, mostly. By default it will be using the brand spanking new Razor view engine… and I’m having a hard time trying to figure out why it’s even in there.

The raison d’être for Razor is to allow for less code in the Views. This too, is a good thing. But I just don’t think it does enough. Here’s one of the samples provided:

@inherits System.Web.Mvc.WebViewPage



It is nice that you don’t need a gigantic header any more, and I like that the masterpage syntax is a little slimmer, but in general all you’re saving are a bunch of <%= %> tags. That’s nice, but is that really that great of an improvement to warrant an entirely new ViewEngine? Am I missing something important here? Especially once you get into non-trivial pages with hundreds of tags and template syntax.

What I think would have been awesome would be to use the reduced <%= %> footprint but also incorporate something like NHaml, which would really minimize the code footprint.

Scott Williams

Written by Scott Williams who lives and works in sunny Phoenix, AZ. Twitter is also a place.