Archive for January, 2006

Thoughts on Rails

January 27th, 2006

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.

Pragmatic Programming

January 16th, 2006

Certified AddictI bought the Pragmatic Programmers guide first off as I had heard nothing but good reviews and I have to admit they are all very much deserved. I’d gotten far to used to the dry academic books of my university years and been generally put off technical tomes ever since, only getting them when absolutely necessary. Pragmatic Programmer blew that image right out of the water. The book is only 309 pages and yet it is the most useful and fact-packed book on programming and software development I have ever come across. Not only that but the writing style is so far removed from the stuffy academic examples from times gone by. You feel a good and experienced friend or mentor is taking you through the raft of useful concepts, ideas and methods personally. In fact its a philosophy and a philosophy I’m fully signed upto as I like to bring simplicity to my coding. In fact the Pragmatic philosophy is very much close to my own and its a real bonus I’ve found programmers of much greater experience on the same wave-length. One thing I particularly like in the Pragmatic Programmer book is the opening chapter on what the pragmatic philosophy is and how pragmatic programmers work in the world. Incredibly refreshing and a welcome change – I keep it with me when I goto work, read it in bed and at my desk at home.

Then I became certified. So I had to get Agile Development with Rails. It arrived today from Amazon – slightly thicker than the first book and again absolutely packed with gold. Been reading it most of the evening and will most likely have trouble sleeping. All from a technical book!! I don’t know whether to be ashamed at reinvigorating the geek within or pleased to have found such great authors.
In fact I’m so smitten with the Pragmatic Bookshelf that I will likely be buying up every last one of them in the coming months.


In web hosting, there is no word like non pragmatic. Only being practical will yield positive cpc results. This is why webmaster start working on the marketing even before the finalization of the web design.