Don’t be so harsh on PHP…

A recent post to a mailing list I’m on sparked the following reply (paraphrased)…

I can’t say I’ve had a play with many of the server-side languages and frameworks kicking around, and to be honest everyday sees a new framework/library/language I should apparently be trying.

PHP has a lot going for it, not in terms of implementation as such (yea it might be ugly!) but in other areas.

For one PHP has been around since the mid 90s it’s now got quite a bit of maturity, what I mean by this is; it has a level of trust around it. PHP on paper was meant for the Web it’s acronym is/was Personal Home Page! Python, Perl were scripting languages back in the day, and while Perl had it’s opportunity with the Web (loaded as a Apache CGI module) it didn’t take off. Now correct me if I’m wrong but Python on the web has only become more popular recently because of Django? Similarly with Ruby because of Rails? You don’t see many people writing vanilla pure Ruby/Python web applications, a lot of people opt to use the a framework. In the case of Rails it includes the kitchen-sink and everything you’d ever need to be able to develop on the web. PHP isn’t a framework out of the box, but offers enough to get you going on the web without the need of a framework. So back to the ideal of maturity, with PHP’s many years behind it it means that a lot of the earlier security flaws you’d expect from a young language have been rooted out. Compare this with the Rails Stack, where there was some quite high profile security flaws announced and patches released earlier this year, I know a lot of fuss was kicked up about it on my twitter feed…

I can back up some of the above statements partly because I worked recently for a large finance organisation, when I mention things like NodeJS and Rails they chuckled because those technologies are considered “hipster” technologies, in the eyes of the bigger boys. For blue chips and FTSE100′s the obvious choices in languages are the traditional ones like .NET, PHP, Java. Their reasons are like I said above, but for a lot of these organisations there are other concerns for example can their system admin scale it up and manage the application easily, and can they bolt on add-ons such as caches and accelerators.

This is where PHP seems to succeed; scalability. The proven killer stack known as LAMP just works and does what you need it to out the box. But if you want to scale you’ve got APC, Memcache, HipHop, even Nginx for better performance. From what I’ve read Rails/Ruby as a web stack has only caught up in recent years in terms of matching PHP’s performance, let alone begin to out perform it. That said I don’t wanna big up PHP too much as; if performance is your thing you’ll want to be looking to build elastic Java Web apps running in a JVM cloud type thing.

How easy is it for someone to download something like Django/Rails/NodeJS and get going on it? Not very, getting my head around RVM meant I had to use my head a little as a geek something a complete freshman won’t have. What PHP offers in this respect is a low entry barrier, literally anyone can download a WAMP/MAMP/LAMP package and within a few clicks of a button be using something like phpMyAdmin and working through some simple examples in Notepad++ and have a website. It’s that easy. The flip-side to this however is those people will ultimately build lots of awful websites before they get better, but this is part of the learning process and keeps experienced guys in business doing the rewrites when it goes wrong. Of course things change when you use a framework as developers suddenly have to conform to a convention, initially its a good thing it means that developer will start to gain some discipline. But I think there’s another blog post to be had here about using a framework or not using a framework.

Going back to my point about the big blue chips; from an employment point of view, chances are Universities aren’t spewing out Rails or Django or even Zend programmers but they will at least cover some ASP or PHP (which I know I covered at both the Universities I went to, in-fact I covered PHP at College too) which means any budding graduates with a taste for web development are going to be using either of those 2 languages as a starting point. Which means there should be a big amount of development resource around for PHP/ASP sites, and leaves things like Django/NodeJS to be more niche, it means the big blue chips can open their doors to graduates and take that academic knowledge to the commercial level.

So lets not be too harsh on PHP it has done a lot for our industry, and it will continue to be used because of the easy accessibility in academia and a vested technical interest from big organisations.

But from a personal perspective, I’ve played with a few PHP frameworks never done any serious development with any of them other than the original Zend. I liked Zend it was my first framework in a commercial setting however I have some reservations about how bloated it seemed. For me CodeIgnitor is a much cleaner framework – it’s code that looks like I wrote it! Not engineered by a commercial organisation like Zend, but I found I didn’t need some of the things in CodeIgnitor and it didn’t provide anything major I couldn’t have built myself. I’ve also had a little play with Slim and have to say I’ll probably be using that more in personal projects, as it’s light. Frameworks aside I’m quite keen on using libraries, I’m quite a fan of Doctrine as a DBAL, and I’m looking towards Twig for templating and even Recess for API things.

But in recent years one thing I’ve discovered without using frameworks in my various commercial settings is that I don’t need them, no one is forcing you to use a library or a framework, yea you get some of the hard bits done for free but you’ll be at the mercy of the framework’s publicly announced security exploits or hindered by it’s performance over head, or baffled by it’s ORM. What ever that original itch was garenteed that library framework will go someway but wont satisfy that itch completely. I don’t think there’s no shame in writting a few classes and instantiating them when you need them yourself, whats wrong with building your own toolkits and libraries?


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>