First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

A few days ago, Simon Tokumine, a Ruby On Rails developer from UK who had to build a web app using, as he calls it, .NET MVC (ASP.NET MVC as we usually calls it), wrote a nice post that makes a comparison between RoR and ASP.NET MVC. Actually it was not really a comparison, more a “ASP.NET MVC for RoR developers” kind of post.
He was a foreigner that came into the .NET country and visited the city called ASP.NET MVC, and he gave his opinion on his first (or second) visit. But not being a local he only used what the tourist guides (the MSDN and the official docs) told him and he didn’t know where the locals gather and what they do make their life easier.
In this post I’m going to give him and to other RoR developers that want (or are forced to) evaluate and eventually use ASP.NET MVC in a project the tips that they need to do as locals do, and I’m going to do address, among the topics that he used in the original post, only the ones that need a response (the others were pretty obvious, like “Learn C#” or “C# is more verbose compared to Ruby”). So, head to his post to read the whole article.

.NET MVC is actually .NET VC

He is right, ASP.NET MVC is addressing only the Controller and the View part of the MVC pattern. I think that there are good reasons behind this decision: .NET developers have always been used to having a lot of freedom, especially in the data access side of things. And I might say that .NET developers don’t like “conventions” that much. ASP.NET MVC is a huge step toward a more “opinionated” and convention-based mindset, but including also a convention-based approach to data access would scared many .NET developers away. Furthermore, there are so many ORM in the .NET space, either opensource, commercial and even from Microsoft. Finally, unlike RoR world, .NET developers have to deal with legacy codebases, and while rewriting the UI side of things is easy and most companies do it every 3-4 years anyway, rebuilding the data access and domain logic is less likely to happen. Just as proof of this, at the moment I’m working on the rewriting of a web app, but most of the services for data retrieval are still in COM+ components built in 1997 by people that left the company. Something that probably RoR developers have the luxury to ignore.

But now that I took the defenses of ASP.NET MVC, let me say that, there is a way to accomplish automatic data validation, binding from request; it’s not baked with the framework, but there is: the way I found the best (at the moment) is using xVal, which allows you to use any validation rule engine and any validation notification library. I used it combined with jQuery validation plugin and the Enterprise Library Validation Block.

Anyway, Microsoft has a data access story for ASP.NET: it’s called Dynamic Data. And there a version of Dynamic Data for ASP.NET MVC (beware, still a preview) in the works. If I’m not wrong, it should rely on EF, but will also allow the developer to use he’s own Domain Model. And there is also the scaffolding feature to help you quickly write your views based on the Presentation Model you want to pass to the view.

And you still want a fully convention-based approach (like RoR’s ActiveRecord), I suggest you have a look at S#arp Architecture, which uses NHibernate as ORM and is based on ASP.NET MVC, or even have a look at FuBuMVC, which is loosely related to ASP.NET MVC and is supposed to take the same RoR approach of being a one-size fits all application framework (not sure the state of the development tho).

The community is extremely anemic

That is quite unfair, probably you didn’t look around enough. There is stackoverflow.com, there is the ASP.NET forum. There are quite a few blogs and blog networks that I suggest you to give a look at: CodeBetter and devlicio.us to name a few. And then there is nice series (in think of almost 50 posts) of tips about ASP.NET MVC by Stephen Walther and one by LA.NET, on most of the aspects of the framework. Another good source of information is the ALT.NET mailing list: even if not devoted to ASP.NET MVC only, it is worth registering to it.

Also, if you look at CodePlex, there are a few projects for ASP.NET MVC, but they are mostly about libraries to enhance the framework itself. I agree with you that there are not as many as many plugins, but what would you expect from a library that shipped less than a week ago?

Documentation is rudimentary

The framework shipped last week, and you based your description on a RC release. The MSDN doesn’t have anything yet, but there are is a quite good documentation on the asp.net/mvc site.

ASP.NET MVC is not OpenSource

Yes, it is not OpenSource, but it is public source (released under the Microsoft Source License). You cannot contribute, but since to code is available you can look at it and fix any bug you find or add your own conventions. The only think that you cannot do is releasing the modified code. But most of the times you’d not need it. Almost everything in ASP.NET MVC is extensible, and you can easily add your own conventions by extending or replacing some parts of framework, like, to name a few, controller factory, action invokers, result invoker, view engines, model binder and so on.
It would have been nice if it was properly opensourced, tho. Not for a technical reason but more for a philosophical one.

Ajax is done by hand

I’d hated if all javascript was abstracted away with a server-side wrapper. But with jQuery and all the plugins there is no need to use that. And, if you use xVal, the client-side validation is written for you, so you don’t need to deal with that boring stuff.

Passing variables to the view can be extremely laborious

That is right, I think this issue as not been solved yet. Together with the “component” story. The best way at the moment is creating a Presentation Model for each view that needs to be rendered, and have this contains all the bits of data needed. It can become a bit tedious for small views, or if you have many views, but better than the looseness of the dictionary of data. I admit this would be easier with Ruby, where you can build the presentation model without creating the class, using the dynamic-ness of the language. There is an extension to ASP.NET MVC to support IronRuby, but it’s still in an early stage. So we’ve to either wait IronRuby or C# 4 dynamic types, whichever comes first.

It’s hard to convert ASP.NET developers to use .NET MVC

I totally agree with you on this: web forms developer have a different state of mind. But this should not be an issue for RoR devs

There is a worry that MS will drop the project if forced to make a cost cutting decision

Now that it is shipped, it’s almost impossible that it happens. Also, there are already plans to a ASP.NET MVC v2 inside ASP.NET 4.0. And finally, if they stop developing on it, they will not cut it, they will just leave it untouched as they did with remoting and they are going to do with Linq2Sql

I hope I helped adding some pointers to resources that were missing in Simon’s post.

But all in all, Simon is right: ASP.NET MVC is not as mature as RoR, mostly for the community standpoint. For most of the people around, that consider things only after they reach the RTM status, ASP.NET MVC is a 5 days old framework, while RoR exists since 5+ years. But I hope that ASP.NET MVC becomes a great community as the RoR one is.

kick it on DotNetKicks.com

Technorati Tags: ,

posted on Monday, March 23, 2009 10:46 PM

Comments on this entry:

# re: ASP.NET MVC for RoR developers: do as locals do

Left by Jake Scott at 3/24/2009 1:12 AM

Well said Sir, also check out the crew at mindscape they are building up the "M" side of the story with a community code repository http://www.mindscape.co.nz/staff/jeremy/ and http://www.mindscape.co.nz/blog

# re: ASP.NET MVC for RoR developers: do as locals do

Left by Andrew Rimmer at 3/24/2009 9:46 AM

Nice article, you bring up some interesting points.

Not having conventions for Models, or having strong opinions brings advantages but also problems.

It isn't easy to combine ASP.NET applications to make a website. If you wanted to combine several apps/modules like blog/forums/shop/people/gallery then it is very unwieldy. In my experience so far you either end up creating a monolithic website that combines all the functionality or you loosely couple several websites into one website. None of these are elegant options.

It is a problem that could be partially solved by the community, but unless its widely adopted won't lead to module/application re-use that is seen in other web frameworks like Django.

It is still early days for ASP.NET MVC, so I am sure it will be looked at.

I enjoy making ASP.NET MVC apps MUCH more than when I was working with web forms.

# re: ASP.NET MVC for RoR developers: do as locals do

Left by tommy at 3/24/2009 2:57 PM

check our S#arp, its a pretty cool framework in the making based on ASP.Net MVC + Nhibernate.

# re: ASP.NET MVC for RoR developers: do as locals do

Left by cowgaR at 3/24/2009 3:33 PM

for me, the "screams" from RoR world are like "famous last words"...

enough said, I think they "see" they are "dying" slowly, MS has changed completely in the last couple of years. It is no longer colsed source IE6 for everyone dictator.

And once the MS MVC platform has its foundation, the inovations and comunity projects easily surpases RoR world, and they fear now they won't catch up, which of course they can't. Can't beat a bear with a foxie.

.NET is too powerful for them.

# Speed!?!?

Left by taelor at 3/25/2009 3:12 AM

Don't you think that it feels a little bit faster to since all that code is compiled?

That's one of the first thing I thought when working with MVC coming from Rails.

# re: ASP.NET MVC for RoR developers: do as locals do

Left by Marko at 3/25/2009 8:13 AM

nice article...mvc is too young to compare it with RoR, but nice arguments anyway...

# re: ASP.NET MVC for RoR developers: do as locals do

Left by Rafael Rosa at 3/25/2009 5:24 PM

Hi,

I just disagree with the community point. I'm living in both communities for, at least, one year and a half, and the Ruby one is much more lively and intense.

The .NET one is still fighting to convince people that good practices are good, testing is a must, patterns are nice, etc. This will probably change in the future (I hope so), but until then, the Ruby community kicks ass.

The fact that the community cannot participate in the actual development of the tools their using is very disappointing, and a waste of resources, but that's the way MS works.

And as far as legacy code goes, you're right, we don't need to worry about it most of the time, and that's where JRuby and IronRuby fit into.

Cheers

# re: ASP.NET MVC for RoR developers: do as locals do

Left by Jack at 3/26/2009 4:56 AM

MVC+JQuery will be my choice in next project!

# re: ASP.NET MVC for RoR developers: do as locals do

Left by raffaeu at 3/26/2009 3:10 PM

Hi Simon, this is a good point of view.
I wouldn't be so pessimistic with the future of ASP.NET MVC but I'm complete agree about the learning curve from ASP.NET to MVC. But let's be honest for a second, how many web developer are really implementing patterns with ASP.NET? And how many of them really know the advantages of MVC or MVP patterns. This is the point.
Do you think that easy WYSIWYG technologies like ASP.NET Dynamic will bring developers to the dark side of the pattern's world? I don't.
The point is the target (the developers) and not the quality of the documentation or the way to implement it.
If we had less zombie coders maybe we will have a better future ... (IMHO) and of course a better implementation in projects like ASP.NET MVC or the Enterprise Library or the EF ...

Comments have been closed on this topic.