My language is better then yours (PHP edition)
Posted by jvanfleet, Wed Jun 06 11:06:00 UTC 2007
In response to a local Richmond resident blogging about Rails and PHP
(Fair warning, if you aren’t a nerd, you might want to skip this post)
Are we (programmers, developers, engineers) still really having these debates? Give me a break. Java vs. .NET, Java vs. PHP, .NET vs. PHP, now Ruby on Rails vs. PHP.
The other day, Jeremy, sent me these. They’re a series of videos created by Ruby on Rails fans, basically comparing PHP vs. Rails. I watched the videos and told Jeremy something along the lines of, “they’re funny, but they’re not really a valid comparison of the languages.” I’ll be honest, I’m too lazy to look up his initial response, but at some point he told me, “they’re entirely valid comparisons.”
My main point was that if you only compare based on what the video’s show, PHP is capable of doing everything Rails is, although the videos, if you knew nothing about the two languages, would lead you to believe that wasn’t the case. I conceded the point that at least to some extent, Rails would win when it comes to Migrations. But even that, you can mimic in some way for PHP, but it might not be QUITE as easily done. You can, without much trouble in fact, abstract your database from your code, you can do MVC, you can do OOP (in fact PHP5 has greatly extended OOP in PHP).
Then I allowed myself to be pulled into the language vs. language debate (although he will most likely claim that somehow we weren’t having a language vs. language debate). It was all quite silly … on both sides if I’m being entirely honest.
I like the fact that PHP will let me put together a quick script without having to go through MVC/OOP/etc etc if that’s all I want to do. I like that it doesn’t make assumptions about how I’m going to set things up, I also like that if I want to get very structured, or even apply a framework, I can. He believes that the fact that Rails forces (force is my word, he would most likely say it just makes a certain way so easy why would you choose another) you into a structure is a plus for the language/framework. He even went on to say/imply that a language that didn’t force that was inferior.
Some of the silliness came in to play later. For instance I think some of the helpers and whatnot available in Rails, while lowering the entrance barrier for new programmers, also create lazy programmers that don’t actually know how things are actually being done, or why it is being done that way. It was silly because earlier in the discussion I had argued that just because PHP allows sloppy code to be written, doesn’t mean the language is at fault, the programmer is at fault. I still don’t really back off of either of my points, I guess that line is just a little fuzzy for me. But I will admit that I could see how me arguing it one direction in one instance then flipping could be seen as odd.
Then later he made the comment that one of the problems in our discussions was we were comparing PHP (the language) to Rails (a framework). That being silly because everything up to that point, and past that point was and continued to be comparing PHP to Rails. Somewhere along the lines I asked if we were comparing PHP to Ruby or PHP to Ruby on Rails. Because if we were comparing PHP to Ruby, the videos were just nonsense. If we were comparing to Rails then we’d need to introduce Cake or Code Igniter on the PHP side, which would again make the videos invalid. He, in some fashion, agreed. Not sure why we continued from there, but we did.
He argued that the great thing about working within the framework and doing things the easiest/forced way was good for when picking up projects from others. My opinion is, you can easily setup standards and processes to create maintainable code within your organization regardless of your chosen language. So that leaves us with having to deal with picking up projects from outside developers. If you think that enough development firms are going to pick up one language so that when acquiring projects from another development firm that it will be easier because it’s written in your language, you’re living in a dream world.
Somewhere he brought up that he thinks PHP programmers are eventually going to go the way of the mainframe programmer, using COBOL as an example. Honestly, one day, that will probably be the case, but good grief that is a premature statement. There are organizations that would label PHP as cutting edge (I wouldn’t agree, but regardless, me myself and I are not the majority), not to mention the large number of large sites running PHP (Wikipedia, Digg, Facebook just to name a few), and Yahoo’s involvement in the community. I would say PHP is still growing, if not exploding. It’s hardly the time to be making funeral arrangements.
So anyhow, I think I’m done ranting about this, but needed to throw it out there. Just to be clear, I think Ruby and Ruby on Rails are great. I consider them powerful tools for development and have not and will not ever consider someone silly for wanting to learn them, nor will I think that my tool-set (PHP + framework or no framework) are somehow superior. I know the language vs. language debate is not going to end here and now. It never will. But, GAH! I’m sick of it. Use what you want to use. User experience is what ultimately matters and they’re all capable of providing similar if not exactly alike experiences. Anyone who disagrees with that needs to come out of their cave.
I believe the target of the videos to be compared to the most common method of programming. For PHP, this means the sort of programming that you say that you prefer—the sort that requires an above-average developer working with language constructs directly. I don’t want to talk about the ads, though, because they have their own agenda and it certainly doesn’t match mine.
To say that one language is better than the other is meaningless. Better in what way? The question should always be asked in a particular context.
Regarding the encouraged choices in Rails, I feel that the reasons to submit mean that you add more value to the product more quickly. For example, Rails is “leading the way” with simple integration with AJAX (the Prototype and Scriptaculous guys are both Rails committers—and have been for almost two years) and added support for REST. The framework is doing the heavy lifting so that I don’t have to. For me, that’s why I am using open-source tools in the first place. In this case, the submission to standards allow you to provide a better product with little additional effort. Hand-rolled applications will almost never have this happen.
For me, the bulk of my language preference comes from language philosophy. Even with the advancements that PHP5 has made in OOP, it doesn’t change the fact that PHP was not built with OOP in mind. It seems to me that the globally namespaced function is the primary tool in PHP. Ruby was built from the other end of the spectrum where everything is an object and even the operators are actually method calls. Neither one is inherently “better”, but for my tastes, I appreciate the additional power that Ruby metaprogramming allows.
The reason that the pressure PHP enthusiasts face is so acute is audience. Because of their size and corporate backing, Java and .NET do not need programmers focused on web development to continue the popularity of their language. PHP does. Like Rails, it was built for the web. I challenge you to produce a measure via which PHP is as popular as those other two languages.
PHP =~ COBOL is not an analogy I would make, but at the same time I’d urge you to consider your claim “You’ll always be taking over a Java project or a .NET project or a PHP project” in light of COBOL, or FORTRAN, or VAX or any other platform that’s been a dominant success in the past. Current popularity is no guarantee of future popularity. In our industry, better mousetraps are ruthlessly adopted.
If your focus, like in your last paragraph, is only on user experience (by which I think you mean developer experience), then language preference may truly not matter. But if your focus as a developer is on avoiding future “forced” language changes, then it might make more sense to attempt to determine which new technologies might eventually usurp the old. My claim is that Ruby and Rails are better positioned to do so that PHP and its framework set.


Wrote a response for you Jim ;)
I’ve gotta say, this is the most civil discussion regarding language differences/advantages/disadvantages that I’ve read in ages. It’s refreshing to see intelligent discussion from differing view points without the vitriol typical of these topics.
But I’m gonna venture a guess, based on the posts, that you guys may already know/respect each other, which helps.