The REST-Like Aspect Of ASP.NET MVC

asp.net, asp.net mvc 0 comments suggest edit

While at DevConnections/OpenForce, I had some great conversations with various people on the topic of ASP.NET MVC. While many expressed their excitement about the framework and asked when they could see the bits (soon, I promise), there were several who had mixed feelings about it. I relish these conversations because it helps highlight the areas in which we need to put more work in and helps me become a better communicator about it.

One thing I’ve noticed is that most of my conversations focused too much on the MVC part of the equation. Dino Esposito (who I met very briefly), wrote an insightful post pointing out that it isn’t the MVC part of the framework that is most compelling:

So what’s IMHO the main aspect of the MVC framework? It uses a REST-like approach to ASP.NET Web development. It implements each request to the Web server as an HTTP call to something that can be logically described as a “remote service endpoint”. The target URL contains all that is needed to identify the controller that will process the request up to generating the response–whatever response format you need. I see more REST than MVC in this model. And, more importantly, REST is a more appropriate pattern to describe what pages created with the MVC framework actually do.

In describing the framework, I’ve tended to focus on the MVC part of it and the benefits in separation of concerns and testability. However, others have pointed out that by keeping the UI thin, a good developer could do all these things without MVC. So what’s the benefit of the MVC framework?

I agree, yet I still think that MVC provides even greater support for Test Driven Development than before both in substance and in style, so even in that regard, there’s a benefit. I need to elaborate on this point, but I’ll save that for another time.

But MVC is not the only benefit of the MVC framework. I think the REST-like nature is a big selling point. Naturally, the next question is, well why should I care about that?

Fair question. Many developers won’t care and perhaps shouldn’t. In those cases, this framework might not be a good fit. Some developers do care and desire a more REST-like approach. In this case, I think the MVC framework will be a good fit.

This is not a satisfying answer, I know. In a future post, I hope to answer that question better. In what situations should developers care about REST and in which situations, should they not? For now, I really should get some sleep. Over and out.

Technorati Tags: ASP.NET MVC,REST

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

19 responses

  1. Avatar for Scott Bellware
    Scott Bellware November 10th, 2007

    With all due respect to Dino for his extensive experience in web development on many platforms, I think that it's a step in the wrong direction to start the REST-is-the-main-apsect-of-the-framework conversations before the framework is even ready for public consumption, let alone ready for use in production CLR web apps, where it will generate real, actionable heuristic feedback.
    If the ASP .NET MVC framework delivers a web developer experience on the order of the Rails experience, then it's success will be traceable to the developer community's understanding that the power comes from recognizing the value of all of the framework's subsystems, and the knowledge and perspective that allows individual developers to wield all of the framework's aspects simultaneously with equal ability.
    We get the most out of frameworks like Rails - and hopefully ASP .NET MVC - by harvesting the emergent value that comes from adeptly unifying the framework's various aspect into a single charge into a web app's problem domain.

  2. Avatar for Work vs. Play
    Work vs. Play November 10th, 2007

    I spent last week in Las Vegas at the DevConnections conference. It was my first BIG conference, although

  3. Avatar for Christopher Steen
    Christopher Steen November 10th, 2007

    ASP.NET The REST-Like Aspect Of ASP.NET MVC [Via: Haacked ] WPF Routed Event Viewer [Via: Karl Shifflett...

  4. Avatar for Christopher Steen
    Christopher Steen November 10th, 2007

    Link Listing - November 10, 2007

  5. Avatar for Eyad Salamin
    Eyad Salamin November 10th, 2007
    by keeping the UI thin, a good developer could do all these things without MVC. So what's the benefit of the MVC framework? I agree


    Well, this is true, but..
    I believe one of the main characteristics of a framework is to force the developers to follow a set of design patterns (for instance: MVC) which results in easily maintainable and consistent applications.
    A good developer usually writes clean code, on the other hand, a good framework forces even average developers to write clean.

  6. Avatar for rajiv das
    rajiv das November 10th, 2007

    Personally I like to get asp.net +
    1. Freedom from viewstate
    2. freedom from having to decide which event to hookup to.
    3. freedom from postbacks breaking history (ajax solves this)
    4. neat urls
    5. good css output from web controls
    whether its asp.net mvc or nething, who cares? give us this.

  7. Avatar for Wiryadi
    Wiryadi November 10th, 2007

    I hope ASP.NET MVC framework keep focusing on delivering the best MVC framework. If you try to satisfy all parties, you'll end up with mediocre product that does not satisfy everybody.

  8. Avatar for Howard van Rooijen
    Howard van Rooijen November 11th, 2007

    Hi,
    has there been any public communication why MVC was chosen as the pattern rather then MVP or Presenter First - http://atomicobject.com/pag... ?
    Thanks!

  9. Avatar for secretGeek
    secretGeek November 11th, 2007

    when i read the title i thought you were going to write about Astoria....
    what's your opinion there? is there some rest overlap between astoria and MVC? any re-use opportunities internally?

  10. Avatar for f baldoni
    f baldoni November 11th, 2007

    Sorry Phil, but I got no value from your blog post. If you have to bend over backwards to explain why something like MVC or REST is such a great idea then chances are it's probably not that great. I'm still willing to listen, but please respect peoples time by posting things of substance.

  11. Avatar for Jeff
    Jeff November 12th, 2007

    Another point of interest is that an ASP.NET MVC framework was demanded by a very loud and vocal minority that does not represent the whole asp.net community: ayende, connery guy, the codebetter.com bloggers, etc.
    Nearly all of that genre are consultants...the MVC Rails-like framework fits there requirements: fast, easy development, etc. They can pick and chose the projects they want to work on, so when integration with legacy systems is not a concern this model fits.
    One thing I have read over and over is that the webforms model is too complex, etc, etc: "A Leaky Abstraction". I think is its rather simple myself and even elegant. I have seen a lot of developers who abuse Page_Load and use it as a continuous block or procedural code...but that is not a flaw in the design, but in the developers. I mean if they can abuse Page_Load, I am sure they will abuse (if they even understand) an MVC pattern.
    However sick and tired I am of listening to the MVC/Rails punch, drunk blogger/consultants that are pushing this framework, I'll be sure to use it in a fitting project ASAP. Not because I feel that its better than the traditional webforms model, but because I now have no choice: in this profession its learn or die...

  12. Avatar for Scott
    Scott November 12th, 2007

    Jeff,
    I haven't seen the actual bits Phil et al... is working on. But from what I've seen in demos, they've built the MVC framework on the same basic System.Web framework that WebForms is based on, but it doesn't interfere with WebForms at all.
    ObfuscatedNerd, ;)
    I think Astoria is an excellent fit for this MVC framework. I'd also like to see how the Dream REST server from Mindtouch could be used in the MVC model. It could provide some interesting uses in distributed, high-scaling applications.

  13. Avatar for Haacked
    Haacked November 12th, 2007

    @f baldoni - I assure you, no backward bending required. I'm sorry you got no value from my post. I got the same amount of value from your comment.
    @Jeff - ASP.NET MVC will *not* replace WebForms + PostBack. It's an alternative means of building a web app.
    @Scott - I'm still getting more familiar with Astoria to better understand how it fits with MVC. My understanding is that it provides a fast way to get data via RESTful queries.

  14. Avatar for Jeff
    Jeff November 13th, 2007

    Yeah, I think my post gave the wrong impression: that I am _so_ punch drunk in love with webforms, that no possible alternative exist. I guess It was more reaction to division within the community that seems to be occuring where either your are ecstatic about the rails/mvc approach and the rest who don't see it.

    The inner geek is excited that there are alternatives, and is seething for the bits. The realist (perceived, of course) in me says that that its going to have limited application outside of new development and/or relatively simple web applications.
    I guess my concerns are rooted in the fact that it reminds of the classic asp mvc-like pattern of changing the view based upon the request and all of the crappy procedural code I saw. HTML vomit being added to the response stream and such...
    I would like to see how well it works with RIA: ajax and silverlight (1.1) applications.

  15. Avatar for ecossaise
    ecossaise November 13th, 2007

    -- Jeff
    > ayende, connery guy, the codebetter.com bloggers, etc.
    > Nearly all of that genre are consultants
    > ...
    > I now have no choice: in this profession its learn or die
    Dude, you're implying you aren't a despicable--I know you didn't say so, you only thought so--consultant. Hence, I surmise you have a cushy job with long coffee breaks, long hours browsing the web on company time, and no pressure to learn new things. Web forms aren't going away. You have the enviable luxury of churning out viewstates until you retire or until Microsoft retires the .Net Framework.

  16. Avatar for Jeff
    Jeff November 13th, 2007

    --ecossaise
    Hehe, point taken. You are wrong in your surmise, however...off by a long shot.

  17. Avatar for Community Blogs
    Community Blogs November 14th, 2007

    Phil and Dino Esposito have been talking about the RESTful aspects of the upcoming ASP.NET MVC framework

  18. Avatar for Ranko
    Ranko December 18th, 2007

    Finally some time for .net. Since Scott and Phil started writing about is I wanted to read and try out

  19. Avatar for Piers
    Piers January 20th, 2009

    I've tried to take those RESTful like aspects and turn them into a full blown RESTful web service on my blog:
    http://shouldersofgiants.co.uk/Blog