I’ve just got back from @media2008. I’ve written up the conference over on the Sitepoint blogs – day one and day two – so I’ll not reiterate any of that here, however I didn’t want to turn those posts into a grumble so I’m back on home territory, where grumbling is almost obligatory.
Once again I sat through a Ruby on Rails demo which started with the presenter showing a slide of a PHP loop, throwing up his hands in mock horror and telling us how utterly horrible this is in comparison to the beauty of Ruby. The attitude seems to border on pity for or amusement at us poor PHP developers who obviously are too stupid to know better. This is usually backed up by an example of some crufty looking procedural PHP mixed up with HTML.
I don’t know about anyone else, but I don’t write crufty procedural PHP mixed up with HTML. The PHP that tends to be demonstrated in these examples doesn’t look anything like the PHP that I write on a daily basis, because these examples don’t compare like with like. A better comparison would be between a Ruby on Rails application and PHP using a framework such as CakePHP. And yes, it is possible to write horrible PHP, but that doesn’t mean that everyone does.
I’ve been a back-end developer for a long time, I’ve developed using Perl, Classic ASP, Java and PHP as well as playing with most other things at one time or another, and poking fun or rubbishing other languages has always been part of the landscape. It’s just the same thing as Mac devotees expressing mock pity for Windows users. However the problem with someone standing up at a conference and poking fun at PHP is that not everyone sat in the audience has 10 years of development experience in order to see through the enthusiasm of the recent convert to make an objective decision on what is right in any particular situation.
I like building web applications, and at this moment I choose to do so using PHP. I don’t want this to turn into a PHP apologetics post so for now I’ll just say that I believe that PHP is the best choice for the clients that we build applications for and the type of applications we are launching. However I do feel that PHP seems to have something of an image problem at the conferences I attend and generally on the web with the articles that are being written. The Rails community is nothing if not enthusiastic and also has the benefit of everyone being on the same page with Rails. If you use Ruby on Rails you do things in a certain way, because you are using a framework that helps you do that. This is a good thing, particularly for novice developers as they are being taught a solid way of working from the outset.
So does PHP have an image problem? There are a lot of people doing great things with PHP and a lot of huge sites relying on it, but had I not known better I would have thought it was a dying language over the last few days. Should those of us who are developing web applications in PHP be talking about it a bit more? Should we be presenting and writing about how we built our applications with non-crufty PHP, whether using our own frameworks or existing ones? Should we be selling the benefits of our chosen language so that people can make a more informed choice? I’d love to see a high profile PHP site that clearly explains the benefits in the way that rubyonrails.org does for Rails. The PHP.net homepage is great for developers but doesn’t do much to sell the language to anyone interested. Comparing PHP to Ruby on Rails isn’t comparing like with like, but as someone who uses and likes PHP as a tool to successfully build web applications, I’d love to see the good stuff being sold as effectively as the Rails community are doing for their tool.