Ruby Goodness
I have been writing some more Ruby lately. I am getting more and more frustrated with PHP’s lack of true object oriented behavior. This has manifested itself with OO database object (especially with dates). I still like PHP5 a lot, but I am starting to feel that Ruby (and Rails) is a better fit for how I want to develop applications.
This seems similar to the transition I went through in 2000. At the time I was writing web applications in CGI Perl. I started playing with PHP but liked Perl more. Then I started to appreciate some of the things that PHP offered that were specific to writing web applications ( header() and $_POST would be good examples). There were ways to do these things in Perl, but it was what PHP was designed for.
Now when I write Ruby (and Rails apps) I feel that it is designed to write agile object oriented code. I have been writing modular web apps for a long time, but it is so much more natural with Ruby. I think Ruby feels more natural for creating these kinds of apps because of ‘every thing is an object’ and ‘meta-programming’. The meta programming stuff allows ActiveRecord to define relationships incredibly easy. In PHP, to do the same thing you would either have to write a method that always gets called, or you would have to create relationships as some sort of array that is an object property. the other possibility would be an XML config file which makes sense in Java, but not in PHP. With Ruby you can just have several has_many or belongs_to statements in a class.
While I don’t like all of the conventions used in Rails, I generally agree with ‘conventions over configuration’. I think I can learn to accept the conventions I don’t like in order to not have to write frameworks for my project.
I also tend to think that Ruby (and Rails) are here to stay now. While I haven’t made the switch of preferred language just yet, I think it is inevitable.
On a somewhat related note, I am going to go take a Zend Certification test this month.
Update: On a related note, the 1.0 version of Ruby on Rails should be released next week. I imagine there will be much fanfair.






