Ruby versus PHP or There and Back Again
September 23rd, 2007Well, I imagine that this opinion piece by Derick Silvers will cause some conversations: 7 reasons I switched back to PHP after 2 years on Rails. The gist being that a big bang rewrite of an existing code base is always a risk and that Rails is optimized more for the greenfield case. He talks about the beauty and power of coding in native SQL instead of database abstraction layers. I am sympathetic to that idea. He mentions hosting in that PHP is small and fast. To which I would add widely available and well known. He asks
IS THERE ANYTHING RAILS/RUBY CAN DO THAT PHP CAN’T DO?
And answers No with the comment
…when I took a real emotionless non-prejudiced look at it, I realized the language didn’t matter that much.
Now I disagree a bit here. It just happens that Ruby and PHP are equivalent in many of the ways that are important. See my post on comparing languages. PHP has some advantages with maturity, while ruby has some constructs, such as closures, that can do wonders in the hands of a skilled programmer. Yet, Ruby also has some disadvantages. I’d summarize that by saying it has all of the maintainability of perl with the commercial attitude of smalltalk.
One of the biggest themes of the 7 reasons piece is that he was able to bring much of what he learned from his 2 year failed rewrite in Ruby back to his PHP version. But, PHP is a different world today than it was two years ago when he made the decision to leave it for Ruby. PHP 5 is a more viable option. Additionally, the PHP community has learned from Rails. Some of the things that made the Rails framework a step ahead, for example routing and url helpers, are now widely available in the PHP world for those who want to use them.
Welcome back, we kept the light on.
September 23rd, 2007 at 10:16 am
I understand the maintainability of perl, but not so much the commercial attitude of smalltalk. Are you implying that Smalltalk never had good vendor-y, commercial support? Kinda like Ruby today? Because that’s not true; in the 90’s the only way to play with Smalltalk was to buy a very highly priced runtime from a vendor. Ah … those were the good days; I worked for one of those vendors.
September 23rd, 2007 at 11:57 am
Hi Jeff –
Indeed; the same is true (perhaps more so) for Rails itself, which was built at a time when the dominant PHP version was still 4.x.
September 24th, 2007 at 8:37 am
I appreciated his article and thought it was written very well. The one thing that I particularly enjoyed is his statement about SQL. Everyone thinks they need to avoid it like the plague, I happen to really enjoy it. I have found with Ruby that most of the time I end up using the find_by_sql statement because I have more control of the performance and end result. I did the same when I worked with PHP.
You are also correct in that PHP has matured over the past 2 years.
September 24th, 2007 at 9:27 am
Amen!
September 24th, 2007 at 11:00 am
Oh come on Jeff, you’ve got to know that languages are just a vehicle and in the grand scheme of things don’t really matter that much… Well, unless you’re showing up to race a formula one event with a Pinto
Seriously though, its ashamed to see people drop Ruby - or any language really - simply because the framework they chose didn’t work out for them. It’d be like dropping PHP because (insert favorite framework, Zend, Cake, Solar, CodeIgnitor, etc.) didn’t work for them.
March 13th, 2009 at 8:32 am
Well, what would you suggest for a newbe?
I want to program for website developing,
I know a bit of PHP coding, and want to go with programing seriously.
Will it be wise to invest all efforts on PHP or go with the Ruby?
Thanks,
Amit
May 6th, 2009 at 5:09 pm
It’s true, there’s not much that Ruby can’t do tbh.
Coupled with the fact that you can do a large amount of the boring stuff quickly & easily it gives you much more coding time to pump into the stuff that matters.