I was ill earlier this week, so out of boredom I thought I’d have a look at Ruby on Rails. Very impressed…
I guess I hadn’t realised, but Ruby is the language, and Rails is the web development framework for it. And boy does it work well. More on that later.
Installation was a bit of a bugger, and I couldn’t get the default installation (which I got here to talk to mySQL at first. The tutorial I was following was Rolling with Ruby on Rails, but I found I had to install the Ruby/MySQL API instead of whatever was installed by default. After that, the tutorial all worked fine.
It’s a good tutorial, so I won’t go through all that – instead I’ll write my impressions.
Okay, so Rails makes you use MVC (Model View Controller) as a design paradigm, but that’s no bad thing – I am a BIG fan of MVC. The Model part is really neat – Rails uses reflectance to define itself; that is, it looks at the database and defines the model based on the definitions it finds within. Clever, and simple.
The view – well, it does what it says. It’s quite nice – you can have templates, the views can have loops or call ‘helpers’. Works well. Plenty of functions for generation of links – and I love the automatic pagination. One line to do pagination – fantastic.
What impressed me the most was the main point of Rails, I guess – you have to do very little to get something that works up and running (which you can then develop upon), and it takes very little code. I mean, during that demo, you get a website that lists recipies, with all the create/delete/update/select actions in a total of 11 line of code, in which you wrote 1.
That’s a lot of bang per buck. I could be tempted off PHP by that.
So, the short of it – not played with Ruby itself so much, but it seems a fairly nice language. Typical one, you know. But Rails – very impressed, I can think of projects that would benefit from this. I expect it will become more popular (much more) though perhaps not amongst some of the PHP crowd, as MVC requires a certain degree of abstract though. If you’re a web developer, you probably want to take a look…