First impressions of CakePHP vs Ruby on Rails
On the upside it’s easy to install on a remote webhost, but unlike Rails, I never got Cake working on my local host as a result of mod rewrite problems despite the fact that mod_rewrite works on my webhost for other applications - so just gave up and moved to remote development. Yes it’s nice to be able to easily deploy on a shared host, but my beloved WebFaction account made deploying Rails simple too. So overall I think Rails still wins in this category.
Cake’s ‘hello world’ blog tutorial doesn’t mention anything about controlling databases like Rails does with it’s brilliant migrations. This is a hassle – because it means I have to keep opening up a remote copy of Phpmyadmin every time I want to edit a database - I thought I was using a rapid development framework? Maybe Cake does offer something along these lines but since it’s not in their tutorial I don’t have the energy to dig through their poorly done docs and API to find out.
I’ve been finding it much more difficult to learn Cake through the Docs, API and users pages and tutorials than I do with Rails. With Rails I have the comfort of knowing that for the most pat an answer is always just a few words in Google away. With Cake the docs are abysmal. It took me a very long time to figure out that I would never find the answer to a very simple authentication component question, then I finally gave up, dug around the application to find the auth class itself and read through it until, relatively quickly, I found a function that did what I needed it to do. Pretty pathetic. Even the tutorials written for Cake in my experience so far have been more or less useless.
Cake is less pleasant to write in – I find myself constantly faced with the arduous task of typing out length variable names – in Rails I can just say <%= Records.band.name %> whereas with Cake I have to struggle through $records[‘Records’][‘Band’][‘name’] – yuck! I realize this is a limitation of PHP of course but it’s a hassle nonetheless.
Another issue I have is that Rails is so sensible to write that it’s easy to remember and relatively easy to understand what’s going on in a statement whereas with Cake even the simplest statements can be so wordy and meaningless that you have no idea - or at least only the vaguest idea - what a statement is doing, and you’ll have a hell of a time remembering the syntax to make even the simplest database query happen without referring back to the API or a previous statement.
There are things that I love about Cake - I find it’s debug function error messages more readable than with Rails, and so easy to turn off and on. I love that I don’t need to restart the remote server to make modifications. With Rails generally my local app and remote app are always in sync so it’s no problem to upload the most recent edit then do a restart, but Cake makes it that much easier. This isn’t really a plus for Cake though, it’s just the nature of PHP hosting. Cake’s form helper in some ways seems easier and more sensible than Rails.
Cake definitely has some advantages and as I continue to do develop with it – which I will most probably since not all jobs allows for Rails hosting due to circumstances beyond my control - I may start to take more and more pleasure in Cake vs at least my previous PHP development which was more akin to free-improv than anything approaching a web framework as slick as Rails or Cake. Also things might start looking prettier in Cake once I learn some refactoring possibilties eg I imagine Cake has helpers that mimic those of Rails, and I’m sure it’s possible to use fat model/skinny controller in Cake as well.
Given my choice of web hosts on a project, I can’t see using Cake over Rails, however with PHP as the only option, perhaps Cake is a good alternative.