PHP: Innocent Villagefolk or a Pillagin’ Pirate?
This is a train of thought article (i.e. it may make sense…or not). You’ve been warned in advance. The CL;DR will be posted to Twitter when Hell freezes over, pigs fly, and Hollywood makes an ensemble casted DC Universe movie. This is what happens when you have a laptop, an editor, a train ride home, and have just realised that the wifi connection is not working.
In PHP, we’re well insulated from what happens in other programming languages. This is not by accident – mentioning PHP while among a crowd of Java, Ruby, Python or Perl programmers is liable to result in a heated argument, several fistfights and one dead PHP programmer. Death by mobbing is not a pretty way to go. I’m sure a few of us have been there – at a web conference where people dismiss PHP out of hand as a kiddie toy for the weak minded and demented. When everyone around you starts nodding, remember to make yourself as inconspicuous as possible and request armed backup from the local PUG.
Of course, PHP programmers all know that the other programming languages are just jealous – PHP has no true OOP model, it’s ugly as sin, can’t figure out which parameter order is right, and is several years behind the curve in adopting best practices but the damn thing remains extremely popular, keeps getting faster, has the best reference manual ever invented, more frameworks than grains of sand on a beach, and in recent years has become a hotbed of innovative libraries now that PEAR and its messy aftermath have been displaced by Github. It’s sickening.
I often wonder why that is. I could go with the usual arguments – PHP is easy to learn, very effective, yada yada yada. Those are the boring reasons we try very hard to believe in. Ruby is easy to learn, very effective, and has even more yadas to go around. It’s still sitting at 11 on the Tiobe Index to PHP’s 6.
What’s fascinating about some programming languages is their reaction to and life after maturity. PHP is an immature programming language which pretends to be mature (to earn Enterprise cookies) but otherwise couldn’t give a toss. I don’t mean that in a bad sense. PHP continues to exude a sense of adventure as it playfully steals ideas left, right and center from its peers. Most of our foremost advances are “borrowed” years after their adoption elsewhere. What PHP excels at is tireless consumption. Marathon races make one hungry and we can’t help but notice the feasts being exposed by Rubyland or Pythonville as they do their best to sprint past us. Without that thieving spirit, PHP would long since have entered obscurity as a quaint HTML oriented scripting language used by college students to build cheap websites with flashing text and under construction GIFs.
To me, PHP is a rogue. If we were playing an RPG, PHP would have pointy ears, a cloak, a couple of daggers and as many lockpicks as it could fit in its inventory (leaving sufficient room for liberated loot, of course). Ruby will never see us coming…our sneak skill is epic. PHP figured out how to keep the W key depressed while crouched in a corner in Elder Scrolls: Morrowind before the game was even designed.
I’m sure this comes across as being a bit humourous, but is it? Sometimes when I hear about PHP being innovative I almost crack up on the spot from disbelief. As PHP developers we’re not often (as in never) in the limelight generating new programming paradigms and practices – we’re most likely to be found connecting the dots between PHP and some novel idea we stumbled across elsewhere. Our strength lies in our ability to connect the dots several hundred times over to the point where the best dot connector gains a critical mass of adoption and we get something like Doctrine, or Composer, or PHP’s new Traits, or whichever of the zillion popular frameworks you prefer that are desperately trying to eke any form of differentiation from MVC (up to and including liberal interpretations of its definition).
It’s a process that works for the simple reason that PHP programmers are immature gits. We love paddling in other programming languages, we love to reinvent the wheel and brag about it, we love to overstate our personal preferences’ importance, and we love ignoring best practices and fighting for the bad ones. There’s a weird benefit to our craziness – trying to get any two PHP programmers to agree to anything is doomed to fail but it promotes competition very well. We’ll write a million versions of anything that isn’t nailed down or too boring to behold while Ruby developers console each other over their One True Way consuming the Last Hope of Mankind (Rails ate Merb and suffered from chronic indigestion – a true but very sad story).
What we really need is a new PHP motto. Something deep and meaningful that exposes PHP’s true nature. I was thinking “Rob ’em blind, matie!” would be a good one but I remembered that we need to cater for the Enterprise audience. Suggestions welcome.
In the meantime, as we struggle with our identity and stay one step ahead of the city guards who have it in for wanted thieves (tends to happen in all Elder Scroll titles), we should be preparing for our next mark: node.js. It claims to be non-blocking. This is excellent, we can get in close with our daggers without any pesky shields getting in the way.
Ruby is terrified by node.js because node.js is the new hotness. Rails 4.0, which is in beta, is the second version of that framework showing fatally unstylish signs of becoming a mature platform for application development. It even demonstrates a use of design patterns. The bastards. There’s only so much the fashionistas can take before they jump ship to the next immature poorly designed piece of crud needing a massive influx of early adopters to beat it into a usable form over the next semi-decade. I’m being overly harsh – it’s not poorly designed, I’m sure stuff like database reads, and filesystem ops can be made non-blocking. Somehow. Pixie dust? Reality distortion field usurped from the bones of Steve Jobs? It sounds like it will be something valuable and very very shiny.
So my brothers and sisters, embrace your inner pirate and revel in it. Now, anyone know if there’s anything worth stealing from NXT-G? It managed to sneak into 20th position on the Tiobe index up from 56th. I want its shiny stuff.