Hacker Musings and OCD

Friends don’t let friends create badly-informed presentations

Sometimes I find myself in a position of defending PHP and it makes me crazy. Look, I’m a Zend Certified Engineer whose day job is writing PHP, I’ve written probably millions of lines of PHP.

I wish PHP wasnt’ the best solution for our company.

But it is! Sure, I can make a series of cases for just about any language from Python to Scala, but I strongly believe that just about anyone with half a brain will agree that today PHP is the best choice for our application and our company.

So I’m in a position of simultaneously agreeing with rather a lot of anti-PHP positions and yet in a position to defend it, because so many criticisms are based on elitism (or “nerd prick waving” as I more commonly call it) or ignorance of what it’s like to work on PHP in a professional manner.

The source of my rage is this piece of shit, seemingly written as red meat for a nerd conference. Ok, fine. Still tweaked my own “I can’t believe people buy this shit” reflex.

It starts off innocently enough: by appending a specific PHP session ID to any PHP file that accepts a PHP session ID in the URL you get the PHP logo. It’s a lamentable “feature” that IIRC has been removed (or will be Real Soon Now). It’s a dumb, dumb idea that needs to go; professional tools don’t need cutesy easter eggs.

Moving on the preso quotes Rasmus on language design, some stuff he said about 10 years ago. Look, we get it: Rasmus isn’t a language designer in the way Larry Wall or Martin Ordersky is. His comments were slightly out of context, though. His point is that there’s a difference between academic and pragmatic approaches to software, not that “HAHAHA BUGS ARE TOTALLY OK”.

It then moves into the bog-standard whining about PHP – it’s got some dubious functionality, it’s got incredible inconsistency in function naming/arguments/etc.

I know that the uber-elite haxors do everything in in the standard editor and don’t need any sort of help ever, but out here in the real world, we have to keep lots of things in our head, so we use tools to help. Here’s what an incompent person like me does when faced with inconsistent function arguments:

Golly, it’s like the computer tells me what I need to type so I don’t have to care about inconsistent arguments.

I chose to use the wonderful PHPStorm IDE for that, but I get a similar effect in MacVim and BBEdit. I’m sure I can do it in Emacs, too. In fact I’m pretty sure in just about any editor worth using will help.

So shut up about this. It’s a solved problem. Unless you’re stupid, I guess.

Moving on, the authors complain about “misconfigured web servers” as a PHP problem because as everyone knows, using Django gives a magical ability to configure web servers.

Idiots.

Anyway it goes on like this for a while, as the authors “show their ass” as we say down home; those unfamilar with down-home Southern phrases can insert “show their incredible ignorance”. Eg, there’s “no real debugger” except for an expensive one and printing to the console; they don’t even mention the wonderful XDebug. I suppose it’s so “not real” it’s not worth mentioning? No “interactive console”? Well, yes, except for the half-a-dozen you can find on Github with no effort at all (I use phpsh, by Facebook of all people, but I’m sure it won’t meet the high standards of the authors of this preso. Even if it does use Python.).

I’m also curious about the statement “makes no difference of debug/production”, because I use that on multiple projects. I have deployed projects where to “take the site live” I change a single word. And in changing that single word it automagically knows to disable debug logging, it knows to use the production cache and not the file-local cache, and so on. Golly I must have fallen through some sort of wormhole into some alternate universe where I have the “good” version of PHP.

Near the end of the preso, these morons show their ignorance in 2 grand ways.

First, they are unable to distinguish between the model architecture of a framework and the primitive functions of the standard library. Just look at pages 29 and 30 of the preso: they seem to genuinely believe that the only way to query a database in PHP is to type $stmt->execute() all damn day, whereas in Python it’s just! One! Line!

Hey, dickheads: we have very powerful frameworks in PHP now. It’s just one line for me, too.

Idiots.

Oh, they try to talk about frameworks, and I guess there’s a language barrier, because they then try to claim that PHP frameworks are bad because PHP wasn’t developed with MVC in mind. Pop quiz, dickface: Python was? (I know some Python and I’ve read about its history and I’m going to go ahead and say, um, no, it wasn’t developed with MVC in mind.)

They even ask (page 31) “Why does this still feel like vanilla PHP?”. My god, the staggering ignorance here. Talk shit that Cake, Symfony, ZF and all the others are half-ass Rails clones all you want, but anyone who uses this stuff day in and day out, it isn’t “vanilla”.

But the crowning achievement of this is what’s the most offensive and amusingly ironic bit of the entire preso: glorious page 44.

“There are many good PHP developers available”

actually rather not the case

and even if it is: good developers?

You spend an entire presentation showing how little you know about the day-to-day use of PHP – you can’t even discriminate between a language and a framework, and your closer is to insult everyone?

Oh, and before I go: Facebook tried to switch to Python, twice, and gave up. They couldn’t scale it, they couldn’t create code fast enough. It turned out to be quicker to translate PHP to C++ than to covert to Python.