Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.

Bin-Blog

Experimenting with CakePHP and Ruby on Rails

I am experimenting with two frameworks that are really popular these days - Ruby On Rails and CakePHP. I will write a comparison between the two when I am done. So far, I think I prefer Ruby on Rails over CakePHP - I still don't understand why.

What they are...

Ruby on Rails

Ruby on Rails

From the site...

Ruby on Rails is an open-source web framework that's optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favoring convention over convention.

CakePHP

CakePHP

From the site...

Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.

My Experience

I have already created a small 5 page application on ROR - it is not something that the public can use - so I am not releasing it. However I am creating another somewhat larger application on ROR - which I will release as soon as it is over. Expect it within a month(or so). As I am using DreamHost, I have Ruby on Rails hosting - so hosting won't be a problem.

So far, I have only experimented on CakePHP - I still am looking for a small project to use CakePHP in. Suggestions are welcome.

ActiveRecord

ActiveRecord is an object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data. Both CakePHP and ROR supports this. ORM is something I want in my projects - I don't like using SQL all over the place.

Basically, that means that I can write

$person = new Person();
$person->name_first = 'Binny';
$person->name_last = 'V A';
$person->website = 'http://www.bin-co.com';
$person->save();

instead of

$sql->exec("INSERT INTO Person(name_first,name_last,website) VALUES('Binny','V A','http://wwww.openjs.com/')");
Do you know any PHP library that will provide this feature? Currently I am looking into ADOdb - but I still can't get it to work - yet.

Disadvantages

I still have not encountered any major disadvantages yet. However, the few problems that I have seen are...

CakePHP

  • Documentation is not as good as for ROR - I end up viewing the source to find what I need. This may be because their search engine shows the source at the top of the results.
  • Not enough tutorials. Also there are some errors(typos) in the existing tutorials.

Ruby on Rails

  • I still have not managed to run my project using Apache - I am still using the Brick Server. This is clumsy as I have to keep a terminal window open.
  • Difficult to find hosting - there are many hosting plans that support PHP - but very few that support ROR.
  • Too much hype. Not necessarily a bad thing.

Related Links

4 Comments:

Anand said...

I am also looking at both CakePHP and ROR. So far, I agree with you that CakePHP as some serious work to do when it comes to documentation and tutorials, but they do have a great IRC channel as does ROR. Both communities are helpful.

My biggest concern is the ability to integrate with existing opne source apps, which the majority are in PHP.

Binny V A said...

My biggest concern is the ability to integrate with existing open source apps, which the majority are in PHP.

This problem, as well as the problem I said about the unavailability of hosting, will disappear after some time. Many new open source applications are created on RoR.

Right now, more oss apps are created using Ruby than using PHP.

raj said...

Mediatemple offers grid computing based hosting for ROR and costs $20 a month. That's one of the best hosting packages for that price for ROR.

Amjith said...

Check for hosting on railsplayground.com for RoR and PHP.

http://beyondaltitude.com