Last night I attended the Winnipeg .NET user group to take part in a “Smackdown” between ASP.Net MVC and my beloved Ruby on Rails. As instructed, I brought a helmet and a bulletproof vest, but it turns out the .NET group was way more friendly than advertised! It was a lot of fun and I hope people enjoyed it.
James Chambers was a great co-presenter and I had a lot of fun comparing the frameworks with him!
So who won?
The original plan was to have both of us coding at the same time, but unfortunately that couldn’t work because we only had one projector. Instead, we both pre-coded a small application and then took turns demoing the various parts of the frameworks. We broke down the presentation into several “iterations” and Amir Barylko orchestrated the event.
Round 1 - Bootstrapping
- How do I generate a new application?
- What about dependencies?
- Code generation?
- Scripts for automation?
For this round, I mostly showed the rails command line, how to create a new application and a quick demo of the rake tasks. I also generated a scaffold, even though I never use scaffolding anymore.
Round 2 - ORM and Database changes
- How do I map entities to the db?
- Is that a default ?
- Any particular pattern?
- What about associations?
In this round I showed a very brief tour of Rails’ ActiveRecord. I showed how to associate two models together and I demoed migrations.
Round 3 - MVC - Routing
- Where are the Models, Views and Controllers
- Can I generate them?
- How’s the routing implemented
- What about REST?
- What about JS requests?
- JSON Support?
We dug into a lot of the “convention over configuration” ideas in Rails here, with a demo of the MVC portions of Rails.
Round 4 - Testing
- What do you get out of the box?
- Is it easy to setup?
- What about TDD?
- What about BDD?
I explained here that Ruby has a deep love for testing. It’s baked into the language and comes with Rails too. I also showed RSpec as my preferred alternative for testing, but really both are great. I also showed some Cucumber scenarios.
Round 5 - Deployment
- What do you need to setup to deploy?
- Is it automated?
- What are the most common options?
I demoed this by deploying to Heroku but in retrospect I should have done a Capistrano demonstration. Either way, it’s very easy to deploy your Rails application with 1 command.
So who won? Audience voting
Screenshot below from Amir’s count so that you don’t say I fudged the numbers :)
You can build great stuff on any platform now a days. It’s cool to see what “the other frameworks” are doing to see what we can learn from them. If you’re a .NET dev, play with Rails and check it out!
Some links from the presentation:
- Rails Demo app: http://pomodoroz.herokuapp.com/
- Rails App source code: https://github.com/marcjeanson/Pomodoroz
- .NET Demo app: http://winnipegtomatoes.apphb.com/
- .NET App source code: http://winnipegtomatoes.codeplex.com/
If you were there and have feedback, please leave some comments.
Thanks to the .NET UG for having me!