Why you really should try Ruby on Rails 1

Posted by Adrian O'Connor Sun, 15 Apr 2007 00:30:00 GMT

I am a .NET programmer, and it was with more than a little skepticism that I read account after glowing account of people who had discovered Ruby on Rails and then blogged about it in euphoric terms and with excited voices.

The more I read, however, the more it struck a really interesting chord for me.

For a long time now, I have felt that .NET has too many short comings. I have written two full products and hundreds of smaller projects in .NET, and almost every time I find that the framework forces me to write ugly code.

Things have been even worse when I have found myself supporting existing applications, written by developers who don’t seem to understand the idea of code that is beautifully simple. Microsoft are to blame for a lot of the bad code out there; It was they who brain-washed the masses in to thinking that Business Logic Layers and Data Access Layers make any sense at all. Of course, they don’t (especially not in the , but lots of .NET code is still written that way.

After spending a lot of time reading up on methodology, practices and patterns (real patterns, as described by the Gang of Four et al, not Microsoft ‘patterns’) I settled on a way of writing my .NET applications with seperate Model and Presentation layers. The models are models in the truest sense, and encapsulate the behaviours and verification in a black box manner (I shall blog about this soon). I was happy, except I seemed to be repeating myself a lot - I hade template code to implement loading an object by ID, for example, but I had to copy and paste it for each class. This bothered me, especially when I later changed my template (I like changing things).

I never managed to truly implement the View/Controller paradigm in ASP.NET, mostly because I like to tinker with my controls from the codebehind.

It was from this backgound that I eventually learned about the marvellous Instant Rails, and decided to give it a go for myself.

First impressions were mixed. I tried to follow the cook book tutorial, but I found it a bit ‘uninteresting’. Still, I learned enough that I could start creating my own pages and looking for more information on Google. I also realised very early on that Rails could do some quite spectacular things.

I bought the book Agile Web Development with Rails. I justified it to myself because I could easily see that certain ways of doing things in Rails might translate to .NET (with a bit of effort), and anyway, continous learning is what keeps the job fun. The reviews were good too.

That book truly blew me away. I have never read so well written a tutorial. I read it cover to cover over a couple of days without touching a computer. I then went through it again, this time following the examples and trying to get my head around the rather mysterious Ruby. It came together so fast, and made such an impression on me that I immediately understood exactly what those bloggers were trying to say.

They were trying to say this: the current accepted way of writing code isn’t really that clever.

Ruby encvourages developers to follow paradigms. These paradigms are not cast in stone, but they are accepted as being Very Good Things. Ruby makes it easy to re-use code and templates in a way that .NET simple can not match. Rails templates are so incredibly simple, yet they can do infinitely more than the shambolic master pages that Microsoft kludged in to .NET.

I think that Ruby will make you a better programmer. It will challenge the way that you approach application development, even if you continue to use C# as your professional tool of choice. Challening convention, especially when done in a thought provoking and intelligent way is always a good thing.


Buy Agile Web Development with Rails (Pragmatic Programmers) from Amazon (affiliated link).

Comments

Leave a response

  1. Deependra Solanky 17 days later:

    Very nice article. I am also a .NET programmer and just last week started to learn Ruby on Rails. So far I am very impressed with it. And by reading this article I feel that I am not alone in world for not liking .NET in comparison of Ruby on Rails.

Comments