Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

Is ASP.NET MVC a half-baked solution?

Earlier this morning, I commented on twitter that I was starting my 2nd full-fledged ASP.NET MVC project, and was finding myself writing a massive amount of infrastructure code. Ironically, having to write so much infrastructure code was a major complaint I had against both Oxite and Kobe. A number of other twitter-folk replied with similar thoughts. There isn’t a day that passes that I don’t think to myself using ASP.NET MVC is a mistake.

Let’s be clear, ASP.NET MVC is an improvement over WebForms – and those developers refusing to leverage ASP.NET MVC (or something else) for new projects are simply lazy. WebForms is full of leaky abstraction, really tight coupling, and ridiculous concepts – such as viewstates and postbacks.

Being able to write complex systems more cleanly is a good start, but given where web development stands in general, and other platforms specifically, ASP.NET MVC lags far behind (Perl being the only one I can think of which is worse).

There’s little question that a big part of the problem is that this is really a VC stack – there is no thought, no support, and no tools for the Model. When you compare the thousands of lines you’ll end up writing for your repository/dal/linq/nhiberate to other MVC stacks (which commonly only require that your models to inherit from 1 class), you’re already at a serious productivity disadvantage. But the true impact is actually much worse – you lose any cohesiveness of purpose through the controller and views. There is no way to generate HTML labels from model properties, or client side validation. In frameworks such as Akelos, RoR or Django everything flows outwards from the model which allows those frameworks to provide cohesive and integrated tools, not just HtmlHelpers, ActionResults and Routing (which is all you get from ASP.NET MVC).

You end up having to do a whole lot of plumbing on both sides of your system.
Alternatively, you can leverage some OSS tools, like MvcContrib, FluentNHibernate, xVal, Castle.*, jQuery. While all of those tools are really great, they too lack any cohesiveness. For example, trying to modify the jquery.validate hook from xVal which relied on modified Castle.Validators (to make them work on FluentHTML) was simply too much work for me. I considered using FluentValidation, but the only reference to xVal integration was a blog post.

I’m a huge fan of these tools, but ASP.NET MVC + 7 different OSS projects simply can’t come close to competing with the elegance, ease of use, and completeness of a well-managed and controlled project like Web2Py (for one of the many examples).

There is some good news, and that’s that a lot of this “infrastructure” is reusable, which makes projects like S#arp Architecture possible. However, I’m still sceptical that these projects can truly succeed against better integrated frameworks.

There will be those that defend ASP.NET MVC by saying that it’s still very young. Microsoft only has itself to blame for being so slow and hard-headed for so long. Others will be thankful that ASP.NET MVC is less opinionated, and thus more flexible, than most other MVC stacks. I agree with this, but only because they ought to have an System.Mvc.Core assembly which contains the open-and-flexible frameworks (yet still provide much more than they currently do), as well as a System.Mvc assembly which is much more opinionated and thus provides even greater functionality.

When you look at the popular web frameworks for web 2.0 style sites, ASP.NET MVC and WebForms are backed by the biggest and richest company (by several orders of magnitude) yet remains the least popular. ASP.NET MVC offers less features, requires more knoweldge, and has lower productivity, despite Microsoft having a cafeteria staff that’s probably 10x the size of PHP, Rails and Django’s entire development teams combined. (Even more ironic, www.asp.net is the only major web-framework website to have ads on it…none of the open source websites do…how screwed up is that?)

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

24 Responses to Is ASP.NET MVC a half-baked solution?

  1. Bu says:

    You might be confusing solution with a framework :) I conside asp.net mvc really positive step considering MS frameworks until now required even more infrastructure code to write. I’ve been using Monorail for a while, without its contrib and castle stack it was as (un)potent as asp.net mvc.

  2. Nice troll, Bob.
    I haven’t got to try MVC but I look forward to anything that gets rid of the coupled idea of pages and code behind classes and that initialize component, postback, view state garbage.

  3. Bob Loblaw says:

    Here is a crazy idea: quit writing about aspnet mvc/microsoft/.net and how much you think it sucks and go off and write about django or RoR or Web2Py. Or, really, do anything other than complain. You sound like a 5 year old girl. Get a life and do something productive.

  4. Josh says:

    Your popularity argument is bunk. ASP.NET MVC was officially released less than a month ago. Rails has been around for what, nearly five years? MVC is the new guy on the block. Give it a year or two and see what happens.

  5. Karl, I feel your pain :-) In the near feature there will be released tons of frameworks which are built on ASP.NET MVC and will contain all the plumbing you need.

  6. karl says:

    Joe:
    I’ve worked on very high-traffic sites, so I’m surprised that the cost to host http://www.asp.net is so high. I’m curious, how many memcached servers you have running? I’m also curious, what percentage of those millions of dollars do those ads cover?

    I hope you guys aren’t scratching your heads trying to figure out why all the web 2.0 startups aren’t using ASP.NET. Granted, I don’t know if that’s cost per month of year, and how many hits you have, but if it costs millions of dollars to keep ASP.NET up and running, how could facebook, twitter or digg ever consider that a viable platform?

  7. Joe Stagner says:

    FYI Karl,

    You are off on what it costs to keep our site on line by well over a million dollars.

    Joe Stagner
    [MSFT]

  8. Tobin Harris says:

    @Simone

    I think MS do take an opinionated stance. They actively promoted the use of all those lovely drag-n-drop widgets, components and data sources, remember :)

    Seriously though, since Microsoft must give developers *something*, why not give them something that’s simple, that covers 80% of developers needs, and incorporates best practice?

    I’d happily see EF used as the model in MVC, providing the usage story is simple enough and incorporates best practice.

    @Paul,

    Community efforts are under way, but they seldom have the same reach as a MS backed product. I pay Microsoft good money for their tools, so I believe MS should deliver the goods. Otherwise I might as well just use a platform that’s free.

    P.S – That Captcha is bonkers! It’s fun to see a fresh approach to an old idea.

  9. Paul Cowan says:

    Why don’t we start defining the things that are not in ASP.NET MVC and then take steps to introduce them?

    I would love something like capistrano in .NET. I think we need to introduce these cmd line utilities more and get away from this blinkered visual studio view of the world.

    Visual studio is just too heavy and does not have an agreeable plugin model.

    We can go back and forth all day sbout what is wrong but what about doing something about it?

  10. Simone says:

    This “half-baked” or “where is the M in MVC” topic has been already discusses a few week on other posts and blogs.

    My vision is that MS cannot release a very opinionated framework because they have to deal with many different forces pushing in different directions: we have the alpha geeks that are fine with working with something with new concepts, but there are also the d&d guys that want to create web apps with the design surface of VS.

    And then, even inside the alpha geeks we have people that like some conventions over other conventions.

    OpenSource project can do what they want and then, if people don’t like their conventions they just don’t use it. MS cannot do it.

    Specifically about the Model: I don’t know you, but I never had the chance (or luck) to work on a new project since 2005. I’m always refactoring and migrating apps. Which means that most of the times I’ve to deal with DAL and BL that cannot be changed. If MVC had a very strong opinion over how the model was structured, I would have not been able to use it on my apps. While now I can still use ASP.NET MVC for the presentation, but keep the old BL-DAL.

    Could have MS released something that works out-of-the-box? Probably, yes, to help people get started quickly.
    But do you imagine the what would have happened if they enforced the use of EF as “Model” (which is the only thing they could have done as EF is the new MS way of doing data access)? Everybody would have complained about that, because everybody loves NH.

    And at some degree they did it: just not (or not yet) in ASP.NET MVC.
    There is Dynamic Data, which goes all the way through to database.

  11. Tobin Harris says:

    I spend a lot of time with Rails, and a lot of time with ASP.NET MVC. I thoroughly enjoy both.

    IMHO, Rails is the more mature or the two libraries. It supports 80% of web development tasks out-of-the-box. It also has a huge array of plugins and gems, which heavily promotes reuse of other peoples work — possibly the biggest productivity tool for software development available.

    I hope ASP.NET MVC will continue to be evolved. I’d certainly welcome the addition of db migrations, one-click deployment (like Capistrano), automation (like Rake tasks), de-facto DAL with plugins (think acts_as_nested_set), easy internationalisation and localisation, BDD testing, smart formatting functions, benchmarking, code stats etc.

    If you expect to see all that stuff in ASP.NET MVC, as I do, then I can see why you think it’s half baked.

  12. Ryan says:

    OMG I hate this captcha…gotta retype all this.

    I think it was a strategic decision to make ASP.NET MVC as thin as it is. Since it was developed fairly openly, that process whould have been hindered with a trillion screaming opinions. This way they can deliver the framework, see what the community does with it, and react to the communities needs and wished. I’m ok with having to write a little more code…it’s much better than having stuff pulled from up some sleeve.

  13. Kent Sharkey says:

    I do think the 1.0 does play into it, but it would really be nice to see a better model out of Microsoft, even if I fear what may be the model. It would also be nice to have the ability for more ability for re-use between projects in general.

    Even as a 1.0, both RoR and Django were already heavily used, and probably the equivalent of where ASP.NET MVC will be in a year or three.

    Also: I have been seeing a few ads on MSDN pages lately. They’re just not as prevalent (or as obnoxious) as on http://www.asp.net. Usually just a small one lower right.

  14. karl says:

    @Kevin:
    You missed my point with respect to rails. The risk there is that I’m a novice. What I’d gain in productivity, I’d lose in learning. The only reason I’m not afraid of MVC/WebForm is because I’m a C#/.NET ninja. That’s the same reason you aren’t afraid of MVC – because you’ve been programming in .NET for 8 years.

    Sooner or later, those little Shoes apps that I build, or web2py sites that I write are going to make me comfortable enough to try my hand at something bigger.

    So I picked MVC because, despite being lacking (imo), I have experience enough to make it work, and make it work well. Its unbelievably short-sited of me, but I’m more of a realist that most people would probably think.

    That isn’t sustainable for any platform. I know enough WinCE developers turned objective-c gurus to tell you that.

    It’s valid to disagree about whether my opinion is right or wrong. As LazyCoder says “If MS had taken a stand and used EF or L2SQL and provided a more model-driven MVC fx, wouldn’t everyone complain about that too?”. I know I would have been complaining (although this is a pretty simple technical challenge that other frameworks have solved).

    But, my point is, that I find myself writing _a lot_ of infrastructure code, base controllers, base view pages and many extension methods. All the samples and demos I’ve seen have been the same. That just doesn’t seem right.

  15. Yes I think MVC is half baked. There was a lot of transparency into the creation of MVC and I think that was a good thing even though it did increase overall time to market but somewhere along the way I feel that something important was lost.

    Working on my first MVC (hybriding a web forms app into MVC) I would not even consider working without MvcContrib, MvcContrib.FluentHtml, or xVal. While MVC works without these projects I feel it does so just barely so.

    I guess I just I expected more from MS for a 2 year project.

  16. Abdel says:

    karl, this is just the first version of the framework, and as of now.. yes it half baked for some reasons. But I am sure the framework will improve and bring a big web apps development change in .Net platform

    Abdel

  17. Karl,

    The part where you lose me is the whole “opinionated” idea (in that ASP.Net MVC isn’t). What it doesn’t do is meet your opinion of what MVC should do. That isn’t the same thing as having an opinion. The development frameworks you prefer I see as restrictive as opposed to productive.

    Unless and until the tooling support for Rails/Django etc. can match the productivity that VS provides me when using ASP.Net MVC, I’ll keep doing what I am doing.

    Also, I don’t agree with your (let’s say opinion) that everything flowing from the model in the way you prefer in Django/RoR is the best solution. I prefer the open structure for modeling the way I want to.

    Finally, if you have been afraid to use Rails in a production system, how can that be a preferable development solution? I have no compunction at all about using ASP.Net MVC in production. In fact, we’re starting a migration effort next week.

  18. karl says:

    David, I agree that Rails is the most extreme example of what I’m talking about. And no doubt one of the things that’s turned me off of actually trying to use it for a real production system is the fear I have of having to mokeypatch some ActiveRecord base class.

    I can concede that ASP.NET MVC shouldn’t become that, but I really think it needs to move towards that at least to some degree.

  19. NotMyself says:

    @karl,

    I see what you are saying, but for many developers in the .NET space if it is not blessed by microsoft it is an unoption. Isn’t something better than nothing?

  20. David says:

    Sorry but I disagree. I was doing Rails before and find ASP.NET MVC much, much better.

    Things I like about it:

    1) It has the right blend of magic and raw metal. Rails has jumped the shark IMO with the amount of connected magic that ties it all together. I like the fact that ASP.NET MVC has imported some of the magic and conventions from RoR and some from Django, but not gone overboard with some of the more esoteric ones. I find my code much easier to read because of this, and I don’t stare for minutes looking at someone elses code trying to figure out what the heck it is doing.

    2) Having the “M” be loosely coupled with the VC is a huge win. Django has this to some degree today. Rails falls down big time on this. With RoR’s ActiveRecord implementation if you stay on the beaten path you are ok, but once you leave it you are in for a world of pain. Yes – the two table application scenario works great. No – I’ve never shipped a real app that has only two tables. (I’m exaggerating about two tables – but I am serious about some of the limitations in the RoR activerecord).

    I think the model binder stuff, HTML helpers, and tool scaffolding in ASP.NET MVC actually does a good job of providing a lot of productivity. I *love* that I can use L2S, NHibernate, or any custom class with it. The UI helpers in Rails are designed to only work with ActiveRecord objects. Once you encounter that brick wall you really appreciate the flexibility MVC has.

    3) The extensibility is really well thought out. I love that I can cleanly plugin everywhere. I spent 12 months working on Rails and ended up having to make changes to the core framework in order to enable certain scenarios. I haven’t had to once make a change to the MVC source yet.

    4) Performance. Man is MVC fast. I spent 2 months before I ditched Rails trying to get a customer site I was working on to have good latency and not require more than 2 servers. It took me two weeks to rewrite the site in ASP.NET MVC using L2S (re-using the HTML, CSS and jQuery code I already had) and it was literally 5x better on latency and 8x better on request/sec throughput – even without all the ugly caching hacks and custom optimizations I put in on the RoR version. My customer went from doubting my skills to thinking I’m the greatest guy on earth.

    5) Tools. This one is less about the framework and more a statement around .NET and VS. I know it is uncool saying this – but intellisense helps a lot. I like that I can work with an object and be able to mostly figure out what it does using intellisense. Having a debugger is something you take for granted until you don’t have one. Add Resharper and TestDriven.Net and my productivity is way higher than it was using TextMate and break statements.

    Are there features I’d like to have in MVC that aren’t there – absolutely. But nothing I can’t live without or not implement myself (I have a growing library of things I’m planning to contribute to MVCContrib).

    I’m a happy camper and ain’t going back.

    Just my 2 cents…

    David

  21. karl says:

    @Lee:

    The ads thing was a bait to see how many people who decide to “discuss” that point instead of the real one.

    No, seriously though. I dislike the ads too, but its the reality that the guy who generously runs this thing has to pay for it. Are there ads on msdn.microsoft.com or microsoft.com? No, it would be stupid if there were. Why is http://www.asp.net any different? Can that team seriously not afford the out of pocket expense of  1-3 servers (or wahtever) ?

     

  22. karl says:

    @NotMyself:
    It’s a valid argument from that point of view. It isn’t a valid point of view from the developer’s community point of view. If you’re looking at building a new site, are you gonna say “Well, ASP.NET MVC doesn’t have many features, but its new, so we won’t hold that against it”? You should hold its immaturity against it and likely pick something else – doesn’t matter why its so feature poor.

  23. Lee Dumond says:

    I’m failing to see how that fact that http://www.asp.net has a couple of ads has anything to do with your argument.

    I see no fewer than SEVEN ads on this very blog post. Are you saying that this negates any credibility that you purport to convey?

  24. NotMyself says:

    Isn’t this like asking, “Is a side of beef a gourmet steak dinner?”

    And the argument that MVC is 1.0 is a valid argument. Trying to come up with every conceivable situation and packing it into a 1.0 release isn’t very agile.