Introduction to MVC at Umbraco Codegarden 2011

The next version of Umbraco (version 5) was released in a Community Technology Preview today. It is essentially a complete rewrite of the Umbraco codebase to move it from classic ASP.NET to ASP.NET MVC. To get the community up to speed, Aaron Powell (@slace) took a full room of conference attendees through a live-coding preview of basic MVC development.

The basics of the Model-View-Controller pattern have been around for a while, but Aaron's description based on an Umbraco context was the following:

  • A model is a set of data that you pass to a view.
  • A view is the UI which displays the content of the model. It has no functionality except manipulating the UI, much like current templates and macros in Umbraco.
  • The controller is the brain, which contains the actual functionality. It constructs a model, picks a view and transfers data.

As with so many other things, Microsoft is late to the party and have found sholders to stand on and cowpaths to walk, but a good thing is a good thing and there is much to like about this approach for developers. For those of us that focus on frontend development, these were a couple of the key takeaways:

  • MVC strives for pretty URLs, and by default will not append file endings to URLs. So thankfully there'll be no more out-of-the-box ".aspx" to turn off. It does however appear that it still prefers to use capitalized words in URLs, so keep an eye out for that if that gives you tics.
  • The .NET heads have clearly decided that Razor is the new black for markup templating, but ASP.NET MVC includes markup scaffolding, so you'll probably want to read up on how to customize this, as it has never been a good idea to trust a Microsoft platform to generate your markup, render your webpages or babysit your kids. I've got my fingers crossed that Umbraco 5 will still support XSLT for those of us who care about our markup — and I'm hoping to have this hope confirmed during the rest of the Codegarden sessions.