Inspired? No home

Rails - first impressions with web development that doesn't hurt

I have dived into Ruby on Rails lately and found it a very pleasant experience. It is a lot more complex to set up than to program it that's for sure. But with the easy to follow guides over at Slicehost I did not take me long. Rails has got a big following in a short time thanks to a lot of hype but mostly due to the fact that it provides web development that doesn't hurt. I am used to utilizing frameworks but Rails takes it to a whole new level in a whole new dimension. It makes it super easy and amazingly quick to create a new database driven web-site. Just create a new rails app, use the scaffold generator and you are good to go:

rails Blog
cd Blog
rake db:create
script/generate scaffold post title:string body:text
rake db:migrate

Now you got yourself a blog without writing any code. The scaffold generator will create the html files for displaying the blog and updating posts and a rails model with code for interacting with the rails framework. It will also even create migration files for creating new tables and fields in your database! By default it also adds id, created_at and updated_at fields so you don't even have to worry about those details. The model itself does not really have much code at all and leaves it up to the rails framework to connect to the database, figure out which database tables/fields to update and to magically come up with a SQL query to be executed on the database server of your choice. The latter is important if you start out development in sqllite, then move to MySQL and later want to use Oracle or MS SQL; Rails understands the differences between these databases.

The rails project has evolved quickly and now version 2.2 is being served up. Unfortunately this rapid development and lack of beginner tutorials on several important subjects makes it a bit confusing to figure out approaches for best practice development. Version 2 introduced changes that makes rails 1.x tutorials obsolete. Having said that the rails community is very helpful and after a bit of googling you do find answers, but not always sure if the answer is the best answer.

What I find most challenging with converting to Ruby on Rails really is the main advantage with RoR: the abstraction of most parts to the rails framework. In asp/.net I was used to writing code for handling database requests and manually manage the relationship between objects. So when I want to accomplish something in Rails I am not always sure of how to utilize the framework or what code to add where.

Written on 05 November 2008.
blog comments powered by Disqus