The Null Device

PHP: a fractal of bad design

PHP: a fractal of bad design; a good essay on why PHP, one of the most popular web programming languages, is horribly, irreparably flawed:
PHP is not merely awkward to use, or ill-suited for what I want, or suboptimal, or against my religion. I can tell you all manner of good things about languages I avoid, and all manner of bad things about languages I enjoy. Go on, ask! It makes for interesting conversation. PHP is the lone exception. Virtually every feature in PHP is broken somehow. The language, the framework, the ecosystem, are all just bad. And I can’t even point out any single damning thing, because the damage is so systemic. Every time I try to compile a list of PHP gripes, I get stuck in this depth-first search discovering more and more appalling trivia. (Hence, fractal.)
Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.
You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.
You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.
That’s what’s wrong with PHP.
I always thought of PHP as Perl's brain-damaged little brother.

There are 3 comments on "PHP: a fractal of bad design":

Posted by: unixdj Fri Apr 13 02:09:51 2012

You seem to imply Perl is not brain-damaged, and I'm not necessarily sure I agree. Perl suffers from a problem similar to C++'s: it's too complex, partly because it's not well thought out. Only that in C++ it's the interactions between different features that bite you; in Perl even things as simple as accessing an element of a hash inside an array are hard to figure out.

Only Go ( struck me lately as a well designed language I actually want to use (and do), but it may be partly due to my uneasiness to write in dynamic languages with no type checking. It just feels... Brittle.

(Luckily, I don't know PHP.)

Posted by: Greg Sun Apr 15 13:45:13 2012

Would a better analogy be to Visual Basic?

An ugly language that promotes ugly program design, but workmanlike in the sense of medium-quality programmers getting medium-sized things done with a minimum of fuss.

(Not being a snob here - I'm one of them.)

Posted by: acb Sun Apr 15 15:06:18 2012

unixdj: I agree that Perl is brain-damaged. (I have written web apps in it.) The fact that different data types have their own syntactic special cases, for example. Though PHP seems even more brain-damaged, if such a thing is possible.

Perl and PHP seem to be both products of a period in which the philosophy of “language design? Let's just slap some things together and see what happens” was popular.

Want to say something? Do so here.

Post pseudonymously

Display name:
To prove that you are not a bot, please enter the text in the image into the field below it.

Your Comment:

Please keep comments on topic and to the point. Inappropriate comments may be deleted.

Note that markup is stripped from comments; URLs will be automatically converted into links.