As I’m sure most of you know, I’m a hardcore C#/.NET guy. The majority of my work as been on the web, and I’ve been using ASP.NET since the earliest betas. ASP.NET’s profound effect on web development is still going strong to this day. For me, the first choice for web application development has been ASP.NET. Well, I decided to venture out a bit recently.

WHAT?

Believe me, I feel a little “dirty” cheating on ASP.NET MVC with a mistress named Ruby but I have to tell you, Rails is incredible. Let the record show I am still one of Microsoft’s and .NET’s biggest fans, and I still love C#. That said, I am one of those developers who just flat out loves learning. I am so passionate about development, it consumes me (just ask my wife). So one day last year, I decided to broaden my horizons and look at Rails. I attribute my development metamorphosis to Manning Publications and the “Pop Quiz” they ran last fall. Their daily questions got me looking beyond the .NET realm into other areas a bit outside my comfort zone. Being outside your comfort zone allows you as a developer to see things in a totally different light. It’s real good to mix things up a bit, and it makes you an all around better developer. In fact Peter Bromberg recently tweeted “I think one should learn everything they can. Then, you’ll be in a better position to decide what you want to use.” I couldn’t agree more.

Why Rails?

Having worked on web applications for just about my entire career, I’m no stranger to web stuff. I started with ASP and worked on from there. I got sucked into ASP.NET MVC when it was released last year, simply because the MVC pattern just makes so much sense. As web developers, we’ve come a long way. I think back to how ASP.NET WebForms changed web development, but as time progressed, with the adoption of more rich interfaces (e.g. JavaScript, jQuery, etc), there are times when WebForms would just get in the way. I know things are changing in ASP.NET 4, but really having ventured to the MVC pattern, I don’t see a compelling reason to go back to WebForm development at all.

The biggest thing that got me stuck on Rails is the MVC pattern. It’s fully baked in and inherent. Coming from WebForms and going to ASP.NET MVC, I’ve found some developers struggling with the concept. I mainly think this is because of the ASP.NET moniker. It’s hard to separate ASP.NET from WebForms when all you’ve been doing is WebForm development for a long time. The other thing that’s a bit gray in the ASP.NET world is how you can use both WebForms and ASP.NET MVC in tandem, and while powerful, it just seems to cause a host of confusion. I witnessed the same issue way back when some VB developers moved to VB.NET. Sticking in the VB world caused them to code things like they were in VB6 and not .NET. Many of them had success by moving to C#. Rails is MVC based like ASP.NET MVC, and you will see many similarities between the two platforms. If you find yourself struggling with the pattern, then you may find a clearer understanding within Rails. You may just find that you too will get sucked in by the allure of Ruby on Rails.

Personally, I got sucked into Rails development almost instantly. Coming from a mostly strict language background, Ruby is just flat out fun and expressive. I won’t go into all the cool things you can do in Ruby since there are millions of examples on the web (where you’ll always see things like 10.times(){puts “Hello World!”} :) ), but the real compelling thing that hooked me was Cucumber*. Ruby lends itself well to DSLs (Domain Specific Languages), yielding BDD tests that are in plain English, and clear not only to developers, but managers and customers alike.

* Of course Cucumber is another one of those things that always gets thrown around as well, but honestly it has changed how I think about projects. BDD where anyone can understand the tests is insanely powerful.

Instant Gratification

The thing that’s so amazing about Rails is how you can go from nothing to a fully functional web app in the blink of an eye. Imagine a full, working application, complete with a database, and even a web server in just a couple of commands, for example:

rails notepad

cd notepad

ruby script/generate scaffold note title:string content:text

rake db:migrate

ruby script/server

Now, just browse to http://localhost:3000/notes, Voilà! You can add, edit, delete, show, and list your notes, all persisted to a database. It doesn’t get any easier than that.

*Edit: I added a post on how to install Rails on Windows if I peaked your interest and you want to get started quickly.

Jump on the Bandwagon

I hope my excitement encourages you to move outside your comfort zone and look at other technologies. There’s just so much cool stuff out there. Anyway, there is a plethora of information out there on Rails: