Marco.org

I’m : a programmer, writer, podcaster, geek, and coffee enthusiast.

PHP Addiction

I wrote Tumblr, Instapaper, and Second Crack in PHP. I continue to use it because I know it extremely well, it’s very easy to use and deploy, and it’s nearly maintenance-free on servers. When you’re a programmer forced to also be your own sysadmin, that’s very attractive.

But I hate it. It’s limited, often clunky, outdated, and deeply flawed.

Jeff Atwood hates it far more than I do, but pragmatism forced him to consider it:

I’m starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it. If you want to produce free-as-in-whatever code that runs on virtually every server in the world with zero friction or configuration hassles, PHP is damn near your only option. …

The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.

Instapaper has too large of a codebase to make a new-language rewrite practical, so I decided a while ago that I at least wouldn’t start any new projects in PHP. But when I wanted to write Second Crack, I went right back — it was a quick little project that I only wanted to spend a couple of days on, so it didn’t justify the overhead of learning a new language.1

I’m addicted to PHP.

When I do finally break this addiction (I can stop whenever I want!), I’ve always thought that the next language choice was clear: Python, which seems to fit my style better than Ruby. But I’m really not qualified to know for sure.

Whichever language I choose to replace PHP will have its own problems that will take me years to master, but by the time I know whether I chose the “right” language, I’ll have invested far too much time in it to practically switch any meaningfully sized project to another language: exactly the situation I’m in now with PHP.

The fear of making the “wrong” choice actually makes the familiar, mastered PHP more attractive. That’s the problem Jeff’s identifying, and it’s very real. If you can get PHP programmers to agree that they need to stop using it, the first question that comes up is what to use instead, and they’re met with a barrage of difficult choices and wildly different opinions and recommendations.

The same problem plagues anyone interested in switching to Linux (Which distro? Which desktop environment? Which package manager?), and the paralysis of choice-overload usually leads people to abandon the choice and just stick with Windows or OS X. But the switching costs of choosing the “wrong” programming language for a project are much larger.


  1. Such a small-but-useful project is exactly what I should have learned a new language with, since making the “wrong” choice would have much lower stakes than, say, the start of a potentially major web app.

    But that would have turned this minor project into a much more time-consuming one at a time in my life that I couldn’t afford any more projects and distractions. I shouldn’t have written it at all, but I’m glad I did, because I really like using it. ↩︎