This post started as a comment to a recent post on KillerPHP.com entitled, “What happened to Ruby? And why PHP is KING of the Web.” The longer my comment became the more I thought I could use a little Google juice myself and why let someone else have all the fun?!
A Twitter post by the normally well-reasoned Cal Evans, Director of the PHP Center for Expertise for Ibuildings lead to my discovery of the KillerPHP.com post that seems to be only the latest in a long line of PHP versus Ruby/Rails rants. I can’t imagine Cal is trolling near as much as it appears the post’s author, Stefan Mischook, but I digress…
I have been a PHP developer since 2001 and founded OINK-PUG in 2005, a month before I discovered Rails and came to enjoy writing Ruby. I prefer Ruby but cannot escape PHP because there is just so much PHP work out there! I am active in both communities locally and would be remiss not to send a shout out to the folks at CART and CincyRB too.
It has been my experience that there is a vast difference in the two communities of developers. Due to PHP’s popularity and low barrier of entry, many developers find it very inviting, especially those with little or no experience. Without much intellectual investment you can produce some rather impressive results, especially using products like Drupal and Wordpress.
Where Ruby shines is when the job calls for something that falls outside of PHP’s sweet spot. Personally, I think it does an equally good job in PHP’s sweet spot but that’s another post. These more challenging cases require more than parochial knowledge of software development; even seemingly simple concepts like a Web UI for SMS can benefit from the skills of a craftsman. That’s where the Ruby community shines and the PHP community falls a bit short.
I suggest that the primary indicator of this is the Ruby community’s embrace of test driven development (TDD) and its relative absence from the PHP community. I would ask those readers who have inherited someone else’s code for both PHP and Ruby projects which they’ve found more maintainable, PHP or Ruby? I always swallow hard when looking at someone else’s PHP code for the first time whereas I know in a minute whether or not a Ruby/Rails project I’ve inherited is going to be trouble. I just look in the “test” directory in the project’s root directory or run rake, created by fellow Cincinnati Rubyist, Jim Weirich by the way!
TDD is only one example of what differentiates the two communities. I can’t count the number of PHP projects I have inherited that were clearly devoid of source control management, or even simple code convention. Excluding the never ending “Spaces vs. Tabs” debate, I’ve never encountered either of these problems with “legacy” Ruby/Rails code. I invite everyone with more than a couple years experience IN BOTH LANGUAGES to add their thoughts about my claims in the comments below. Everyone else, knock yourselves out. Beat me up. Beat on Stephan. You won’t, nor should you expect to change either of our opinions.
Yes, Twitter could have been written in PHP, Wordpress could have been written in Ruby, and Drupal in Python. If that’s all you’ve taken from this post then you’re not “getting it” or more likely, I’ve poorly stated my argument. Nonetheless, clearly Mischook has a bone to pick with Ruby but I find nothing new in his rant and took the bait anyway. I’m overjoyed that he loves PHP so much. I did too, until I found something that “I” like better. I don’t feel the need to justify my decision to others, although I think I just did. Anyone (including me) can write bad Ruby code. Some can write beautiful PHP. In fact, some of the brightest people I know still write PHP but I say, let them eat CakePHP.