ASP .NET MVC vs Ruby on Rails
I recently watched the NDC 2011 video comparing ASP .NET MVC versus Rails. It's a great overview for a non Rails developer comparing features of both. Rails was developed in 2004 and ASP .NET MVC was developed in 2009 so Rails has a 5 year head start on ASP .NET MVC.
The first point, made in the talk is that Rails has a better logo and ASP .NET MVC has no logo. This was a funny point but well made. Open source projects almost always have a cool logo and Ruby has one as well.
I made a summary of the major talking points in the video and chose my personal winners.
Ruby on Rails | ASP .NET MVC | My Winner | |
IDE | Rails can be developed in notepad. Rails can be developed on Mac or Windows. | Locked into Visual Studio. Visual Studio is slow and crashes weekly. Requires Resharper or CodeRush to be effective. | Rails + 1 |
Controllers | Rails has respond_to so it can return json, xml, or html easily from an action controller. | Very similar. You can respond_to like behavior with the NuGet package easy MVC. | Rails + 1 |
View Helpers | Rails has many more view helpers. | MVC has strongly typed objects in the view. The MVC view helpers are very noisy. | Tie |
Scaffolding | The scaffolding is almost identical to the Rails scaffolding. | Tie | |
Data Access Active Record vs. EF Code First |
Active Record has a more readable syntax with has_many and belongs_to. Supports more databases. | EF Code First still doesn't have migrations, but they are coming. | Rails + 1 |
Validation | Data attributes are more limited than the active record validation mechanism. | Rails + 1 | |
View Engine ERB vs Razor |
ERB has a very noisy using the old <%= syntax. | Razor is a great view engine with very clean syntax. | MVC + 1 |
Gems/Packages | 25,000 gems! | 2,000 nuget packages. | Tie |
Interactive Console | Rails has an interactive console. | No interactive console. |
Rails + 1 |
ASP .NET MVC loses 2 points due to it's messy data access story. MS changes it's mind about Data Access constantly and EF Code First isn't feature complete yet. The point is they are very comparable stacks now. One major advantage or perhaps disadvantage would be the underlying languages: Ruby and C#. Ruby is a very malleable language and never has the same testing issues that C# often has.
Final Score Card: Rails +5 - MVC +1
This doesn't tell the whole story. If you don't care about the interactive console and you think Visual Studio is a better IDE, then the final score would be:
Final Score Card: Rails +4 - MVC +2
Once EF Code First matures ASP .NET MVC and Rails stacks will be on equal footing.