After getting the Agile book a couple of weeks ago (?) now I’ve been working on a few Rails projects to get some practice in. My first one and current favourite is actually a port of an existing PHP-based system on race car results that was once used by a client. I thought it would be simple as the database structure was already in place and the PHP would help me in the process – WRONG!
Empty the Cup!!
Obviously I knew from reading the book about Rails structure and the fact its a ‘full-stack MVC framework’ but what I didn’t realise is that my PHP code would cause huge mental translation pains. The PHP was an utterly indecipherable mess in comparison to what I was trying to create. It was like trying to construct a whole orange out of the pulp of its cousin.
So porting actually made it harder. It wasn’t until I completely dis-regarded the existing code and looked at it from a completely fresh perspective that I started to get somewhere. As the old Zen saying goes – You must empty the cup before you can start learning.
Clean & Simple
Rails is clean and intuitive. If you’re not a Ruby user then you may find the syntax a little odd but you soon pick up enough to use Rails comfortably. The light yet powerful MVC architecture is a massive bonus if you’ve not had the luxury or resources in the past.
Ajax
I’ve used in Ajax with PHP and it wasn’t quite worth the effort. Rails is different though as it makes the process of including Ajax in your application as easy as non-Ajax elements. You can tell the Rails team have gone all out on making the framework as easy, clean and fresh as humanly possible and they’ve pulled it off in a big way.
Not only do you have the usual Ajax functionality using prototype but you also have a selection of extra features such as fades, drag-and-drops, etc.
Testing
Tesing is built right in from the start with Rails and I was amazed at how comprehensive it is. Before you’ve even started coding you have a skeleton for testing. Its all part of the philosophy of test-drive-development which I’m still getting used to but is so far paying off dividends in saved time and productivity. I won’t go into the details of TDD but you can get further info here:
Validation
Rather than coding individual tests on a page for various record additions or edits you can add validation of data to the model itself and any discrepancies will be reported to the view automatically drastically reducing the total ammount of code required. This was a major boost and simplified things no end.
Bugs…
I was a little suprised to find a bug in the framework so easy on but after posting at the Rails mailing list it was confirmed there is a bug in the datetime_select method in that you can’t disregard year selection. This means that if you wish to only have a time selection you must use another less ideal method. Its the only bug I came across but its a pretty big one considering its recently hit version 1 I expected a little better – especially as its otherwise incredibly solid and well made.
Overall
Fantastic. I’m enjoying using the framework but I don’t think its the saviour of the net and there are other frameworks out there that are just as worthy as Rails. Rails is good and its achieved a lot and in a very nice way. However, some others worth considering if you’re about to take it up are available at this blog.
* Django in Python
* Fanery in Python
* Subway also in Pyton
* TurboGears another Python framework
* Catalyst in Perl
* TrimJunction in JavaScript
* Cake in PHP
* Symfony in PHP5
* Seagull in PHP
* PHP on Trax another one in PHP
* MonoRail in .NET
* Wicket for Java
* Sails for Java
* Trails also in Java
* Seaside in Smalltalk
I’d like to add TurboGears to that list too as its certainly deserving of the same hype as Python as it offers a hell of a lot in the language of my choice: Python.
Getting broadband connection is a must for every webmaster, only then can you continue with search engine marketing methods like pay per click.
