ASP.NET MVC preview available

The first public preview of Microsoft’s ASP.NET MVC (model view controller) framework is now available.

Download ASP.NET 3.5 Extensions (EXE) (3.7 MB)

Download MVC Toolkit (ZIP) (400 KB)

The project takes cues from Ruby on Rail’s success and looks to address dissatisfaction with the testability and maintainability of WebForms applications and provides an alternative approach that is centered around views, models, controllers with a clear separation of concern and the ability to mock test the individual elements.The official documentation is online and there is a great four-part series over at Scott Guthrie’s blog which covers:

Phil Hack and Rob Conery are both now at Microsoft and working on the framework, they have some interesting things to say on it too:

A few other people have already written about the subject too:

Most of the examples and many of the routines/helpers fail to encode output which opens them up to HTML and script injection vulnerabilities. Remember to HttpUtility.HtmlEncode output and use Reflector if you’re unsure whether a function is encoding correctly.

The CTP requires Visual Studio 2008 to get the most out if it so either head over to MSDN Subscriber Downloads or grab a 90-day trial edition if you don’t already have it installed.

[)amien

10 responses  

  1. I find myself amused when reading comments on articles about this MVC stuff, by all the people lauding it as some kind of revolutionary ray of inspiration. Really of course most of it’s directly copied from years-old frameworks like Rails, Struts, and Spring. The fact that it’s taken this long to be recognised as an essential component of an application building toolset is rather indicative of the maturity & size of typical .Net deployments, IMO. It’s what I’ve harped on about for years – .Net might have had all the lovely low-level programmer helpers, but it’s been sorely missing any kind of decent best-practice application infrastructure for far, far too long. Maybe this will finally change my long-held opinion that programmers like .Net, architects like Java. ;)

    steveDecember 10th, 2007
  2. I don’t believe anyone is hailing it as revolutionary or inspirational.

    It’s quite clear from the developer blogs that it is in response to the success of Rails.

    As for doing web development in Java – you couldn’t pay me enough to go through that painful experience again. Of course architects love it because there are a hundred different competing solutions and technologies. Programmers will hate it because you can bet the architect has slipped in some flavour-of-the-month piece to the puzzle that they now have to learn and integrate for little or no obvious benefit.

    [)amien

    Damien GuardDecember 10th, 2007
  3. Well, my experiences were entirely different. At least with Java you’ve had proven frameworks instead of having to take the rudimentary stuff that’s there in .Net and build your own for the umpteenth time.

    Little or no obvious benefit? The features provided by Struts and everything that came afterwards do precisely what all the MVC stuff here claim to do, and more – if they provide no benefit then so does the .Net MVC framework. The difference is the Java frameworks have been around long enough to have been battle tested in real, mission-critical applications, rather than being mostly in beta / CTP like so much of .Net seems to permanently be.

    steveDecember 10th, 2007
  4. So… if Microsoft go off and do something completely different you blast them. If they follow the best practices everyone else developed… you blast them?

    The Java stuff would have been in a development cycle at one point too. Sure there are a few cutting-edge pieces in CTP, that’s what an active development cycle that takes feedback on board looks like… :p

    [)amie

    Damien GuardDecember 10th, 2007
  5. I’m not blasting them for doing it, I’m just exasperated it took them so damn long to realise it was necessary – an indication in my enduring view that .Net has a hell of a lot of maturing to do in the framework dept, and that a lot of people don’t even realise what gaping holes there are in it in this dept (present company excepted).

    Cutting edge? That’s my point – all this stuff is what other frameworks have had for literally _years_, yet its (beta) implementation in .Net is lauded as newsworthy. .Net has concentrated on low-level coder friendliness for so long, it wins in the publicity dept but in terms of real application building productivity it’s years behind other frameworks. I hear of so many people building their own frameworks from scratch or fighting with buggy unpolished frameworks (in this blog, for example) and thus wasting so much time and money when there are frameworks out there that actually _work_ and are _proven_, yet because they’re not sexy enough from a programmer perspective, or require a little bit of extra effort in the initial stages to unlock their (far greater) potential, they get ignored. It’s just missing the big picture IMO.

    Ignore me if you like though :). By the time people realise all the money they’re frittering away writing their own frameworks and suffering buggy beta efforts, maybe the .Net frameworks will have caught up enough and the argument will be moot. Huge waste of resources in the meantime though, IMO.

    steveDecember 11th, 2007
  6. The individual Java pieces may be mature but trying to get a handle on the which pieces to use is a nightmare. In my degree we were told to use a specific set which went against the grain of web development – in fact you later told me I was using the wrong technology.

    Java SE or Java ME?
    WebWork, Struts, JSP (JSTL or tag libraries?), JSF, Google toolkit, Spring?
    WebSphere, BEA, Tomcat?

    http://www.oreillynet.com/onjava/blog/2006/06/isnt_rails_supposed_to_change.html
    https://equinox.dev.java.net/framework-comparison/
    http://www.virtuas.com/articles/webframework-sweetspots.html

    A single choice of language, a multitude of frameworks, a plethora of application servers and no doubt issues with integration, configuration, testing and deployment.

    I’d go further and say that whilst Java may have had years of development behind it to be really mature it should shed what didn’t work and aim for a leaner and meaner set of technologies and KISS.

    [)amien

    Damien GuardDecember 11th, 2007
  7. I’ve deployed more than one real-world app on Java and it’s a case of picking the best solution for the job. For a mission critical, multi-server enterprise app WebSphere fitted. For a smaller web system Tomcat was fine. Both used the same underlying tech, J2EE which is just a set of packages built on J2SE. Which packages you need depends on whether you want things like transactional messaging, web services, etc and will affect whether you need an enterprise grade implementation like WebSphere or something simpler. Typically there are preconfigured ‘sets’ of frameworks known to work well for a particular need, like Spring or now JBoss Seam.

    Having many options isn’t a bad thing. In my experience Java is not hard to use or get working, provided you’re willing to put the up-front time in. Sure it’s not as instant gratification as .Net, although that’s improving all the time, but once you get it going you can do more. KISS is all very well so long as you don’t need the bits that are missing in said simple implementation. Like an MVC framework for example.

    Is it really better to have something that is simple on the surface but when you dig into the more serious stuff like frameworks, there are parts missing you have to build yourself? Or something that’s perhaps a little harder on the surface but has lots more depth if you take the time to dig? I prefer the latter, personally, because I don’t want to spend time writing frameworks, I like to write the parts of the software that are unique to the problem I’m solving.

    steveDecember 11th, 2007
  8. “WebWork, Struts, JSP (JSTL or tag libraries?), JSF, Google toolkit, Spring?”

    By the way, most of these are complementary and not confusing choices at all. The only real choice in that list is ‘Struts or Spring’.

    WebWork is Struts v2 now. It’s just the second iteration of the MVC approach based on years of real-world experience, most people doing new apps will use Struts2/WebWork now. Spring is a slightly different take on the ideas that evolved in parallel to WebWork. Which you prefer is going to be based on your preferences and needs, Spring has a wider enterprise app focus which includes what Struts does, whilst Struts just concentrates on MVC web apps.

    All the others are either used in Spring/Struts or are complimentary. JSP is the base server-side web page implementation, tag libraries makes JSP easier to use, since you hand-code less, JSTL and JSF are pre-written implementations of useful view-related tag libraries, built upon the previous techs. So if you use Struts or Spring you’re probably using all those anyway, in the same way as when you use .Net you’re using a bunch of component techs like ASP.Net and libraries.

    steveDecember 11th, 2007
  9. Oh, and finally, in my experience university teaching of Java is terrible. They teach the language but they never touch on the frameworks you’d use for real business apps. Unfortunately this gives a circa 1997 view of Java really which is highly misleading because it misses out on what is Java’s great strength – more than 10 years Darwinian evolution of good frameworks.

    MS might take feedback on their development in .Net, but it’s far from open. Most of the frameworks for Java have evolved ‘in the wild’, being tested repeatedly on real projects, and then sometimes folded back into Java core after years of refinement (such as the Apache Jakarta incubators). It’s sort of a mixture of centrally controlled development with the official Java packages and open source for everything else, which I think works really well. It’s not as sanitised and simple as a single vendor controlling everything, but I’d argue that more gets done.

    steveDecember 11th, 2007
  10. >>So… if Microsoft go off and do something completely different you blast them. If they follow the best practices everyone else developed… you blast them?<<

    :)

    If someone’s made up their mind… well there’s not much you can say. Backing up your point with Java is almost as bad as Regex :).

    I also meant to tell you, Damien, that your “voice” was in the back of my head the whole time I was working on the HtmlHelpers, making me triple-check for Html.Encode at every turn :). Don’t stop beating on me… or us! You are heard :).

    Rob ConeryDecember 11th, 2007

Respond to this