CakePHP vs. Ruby on Rails
Why I chose CakePHP over Ruby on Rails for my websites.
There's no doubt about it, Ruby on Rails is awesome. The guys at 37signals make great software on top of Rails to prove it. Ruby is a very easy language to learn too. So, why did I decide to use CakePHP instead? Well, there's a few reasons.
As a web designer/developer, I'm often faced with the task of rebuilding an existing site. This means I'm usually stuck using their web host, as opposed to one I recommend. That's where Rails can fail. In order for Rails to work, the web host has to support it. When I first delved into Rails, I tried to set it up on my Linux server at home (I didn't want to use the Webrick server), and that's when I got a bit frustrated. It was difficult, and I needed to develop an application like yesterday. My server was already configured for PHP, MySQL, and Apache with mod_rewrite. That's all CakePHP needs to work, and most web hosts meet these requirements. Besides, I'm already really familiar with PHP.
It's also worth mentioning that a lot of the screencasts for rails involves using scripts on the server's console. Most websites I design are on shared web servers, so shell access isn't available. There's ways around using these scripts, but still, it makes these screencasts appear too good to be true. CakePHP is just more realistic for a broader audience. Don't get me wrong, Rails is good, and Ruby is arguably an easier language than PHP, but the code is only half of the battle. We have to take everything into account.
As a web designer/developer, I'm often faced with the task of rebuilding an existing site. This means I'm usually stuck using their web host, as opposed to one I recommend. That's where Rails can fail. In order for Rails to work, the web host has to support it. When I first delved into Rails, I tried to set it up on my Linux server at home (I didn't want to use the Webrick server), and that's when I got a bit frustrated. It was difficult, and I needed to develop an application like yesterday. My server was already configured for PHP, MySQL, and Apache with mod_rewrite. That's all CakePHP needs to work, and most web hosts meet these requirements. Besides, I'm already really familiar with PHP.
It's also worth mentioning that a lot of the screencasts for rails involves using scripts on the server's console. Most websites I design are on shared web servers, so shell access isn't available. There's ways around using these scripts, but still, it makes these screencasts appear too good to be true. CakePHP is just more realistic for a broader audience. Don't get me wrong, Rails is good, and Ruby is arguably an easier language than PHP, but the code is only half of the battle. We have to take everything into account.
Comments
Comment
1 Yep
A lot of clients use own host. And hoster don't like to setup any software ;-)
Even php5... A lot of php4 and may be 1-2 php5 hosts.
So, this one point, why I choose CakePHP - php4.
But, I find normal host wiht python, ruby, php... for my blog <a href="http://www.ouch.kiev.ua">ouch</a> ;-)
So, I hope in near time I study Ruby and could find different between cake & ruby, by myself.
Comment
2 Scripts
Comment
3 Clarifying
You make it sound like Cake needs mod_rewrite to work, this is not true, Cake can work without mod_rewrite.
Comment
4 Layers
It's pretty much like...
lighttp
ruby
rubygems
rails
a load balancers and whatnot
version management / whatnot, svn, capistrano
and there are wayy too many options for servers, etc. Mongrel, lighttp, apache, scgi, fastcgi, webbrick... each one has too small a share for it to be efficient in that area.
Comment
5 php4 always needed
a real life example: a non-upgradable plesk server, 7.5.4 reloaded on debian, just can't handle php5, so it is sticked with php4.
Comment
6 In defense or RoR
> I don't like those little scripts you use in shell.
> They make code for you. I don't like to modify code
> which was generated by machine.
Actually, scripts/bake.php in Cake does the same. The code "generated" by RoR's script/generate is only the skeleton.
You don't have to use the generators, you can create the files manually and declare classes by hand. There really is no difference between RoR's generators and Cake's bake script :)
Tom said:
> It's also irritating how Rails needs a huge stack.
> It's pretty much like...
> lighttp
> ruby
> rubygems
> rails
> a load balancers and whatnot
> version management / whatnot, svn, capistrano
Actually, you only need a webserver (lighty or apache can do alone if you control the environment), a database server if you are going to use a database and ruby installed. With Apache and MySQL you can do fine (though you *do* need mod_rewrite).
The rest of the stack is optional. Think that for Cake, you could benefit from running the app in a server cluster and using a load balancer the same you benefit for rails. You don't *need* svn or capistrano to run rails apps, it just eases deployment.
Rubygems and rails aren't needed to run rails, just to generate the app, you can do so in your development box and then upload the completed app. In the same way, you don't need to run the scripts *in the server*.
For example, you don't need an editor with syntax highlighting to program in php, it just speeds development by simplifying the task :)
In the end all you need in the server is ruby, a webserver with rewrite_capabilities, and maybe a database server. After that, it's all optional.
Comment
7 sdfgdfg
symfony is too fat. i like cakephp more than symfony and/or RoR.
installing RoR on a linux is a little more complicated than installing on a Windows. Although I love the principles of RoR, I'd still prefer PHP not because of its quality language, but more of (i dont wanna use this term) prejudicism.
Comment
8 RoR vs Cake
At that time i was coding php, and starting to make my framework tools. RoR is much more powerfull so i decided to eventually skip to RoR.
But then i read about the CakePhP framework. I tried it and now im addicted to it. Finally im getting to the point where i can do all the interface/interaction experiments with all the data handling already done (im builiding my own (2.0?) cms for use in profession) I have built 3 commercial websites on Cake. One of them is a medium sized funsport travelagency. Im looking forward to the launch cus im pretty curious about the realtime performance on the server. I get the idea Cake's abit slow in data collection sometimes.
When i have the time, ill check out RoR again, the combination with ruby is very powerfull. My understanding of the framework structure has grown since i already knew how to handle php.
Ill stick with php for now but on the long-term, when websites become larger and more complicated, RoR is the way to go i think. The OO language syntax is somewhat more readable than php (when you get more skilled) and you can create offline programs + numerous of other very cool features. Also the documentation on RoR and Ruby are pretty good. Not as abundant as php documentation but quality surpasses quantity in my opinion.
Question
9 Dynamic Scaffolding
Anyhow, I was wondering if Cake has the ability to generate the model, the controller, and all of the views for you when it comes to CRUD. I know that Cake has the "scaffold" option, but what I want to base level code generation for creating production CRUD. Much like $ ruby script/generate scaffold <name>. Can bake scripts do this for me?
Comment
10 Bake scripts can.
Comment
11 CakePHP vs Ruby On Rails
<a herf="http://klimb.com/blog/?p=12">
CakePHP vs Ruby On Rails</a>
Comment
12 CakePHP vs Ruby On Rails Article
<a href="http://klimb.com/blog/?p=12">
CakePHP vs Ruby On Rails</a>
Comment
13 things are changing
so, at least, one of the reasons of this article is "old".
Comment
14 Setting up RoR is no harder than installing PHP MySQL Apache Cake
Only as complicated as installing Apache, MySQL, Ruby and mod_rails for Apache.
I was able to setup this environment in 10 minutes.