Tim Bray on PHP

By Deane Barker on February 22, 2006

On PHP: There have been a lot of blogs jumping around on PHP in the last few days, and I’ve finally tracked it back to its source. Tim Bray — one of the “pillars of the Web,” if I can be so bold — posted about PHP a week ago. He mentioned about how much press PHP has been getting, then dropped this:

So here’s my problem, based on my limited experience with PHP (deploying a couple of free apps to do this and that, and debugging a site for a non-technical friend here and there): all the PHP code I’ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places.

And this is apparently where it all started. What’s interesting are the comments flying at Tim. He doesn’t have comments on his blog, so he’s manually adding them to the post because he’s been impressed with the discussion.

Adam Kalsey, I think, hits the nail on the head most closely in the very first comment.

[…] since PHP is easy to learn, is ubiquitous, and there’s lots of PHP examples on the web, it’s easy for a non-pro to pick up PHP and start monkeying with it. They learn bad habits and then publish their code and teach others bad habits. Some of the most popular open source PHP applications ever are really poorly coded. Gallery and WordPress come to mind.

And that’s the truth of it: PHP is so easy, that the barrier to entry doesn’t weed out people who write crappy code. Classic ASP is the same way — there’s a lot of heniously bad ASP floating around out there. And ColdFusion — I’ve seen some stuff written in ColdFusion that would curl your hair.

But at the same time, there’s good ASP — I’ve personally written some great ASP. I have a project now that I have to write in classic ASP, and I think it’s as good as you could possibly write something in ASP without resorting to COM. FogBugz is written in ASP, and I’m willing to bet it’s good ASP because Spolsky is a friggin’ ninja.

And there’s some great ColdFusion too, including full-blown frameworks like Fusebox and Mach II.

And, of course, the same goes for PHP.

I don’t want to beat a dead horse, but if you go back to my post on Camaros and PHP, you’ll see I was saying something along the same lines. More complicated languages like J2EE and ASP.Net have a higher barrier to entry — it just takes longer to figure them out — so the people who are going to write bad stuff tend to drop out and turn to something easier…like PHP.

PHP is therefore a victim of its own simplicity, flexibility, and ubiquity. I guess I can think of worse things than that.

Gadgetopia
What This Links To

Comments

  1. Nice post Deane. As I did on the Camaro post, I will continue to politely disagree about one small point, at least when it comes to .NET. The financial barrier to entry is definitely higher with .NET, only because you usually have to shell out for closed-source toolsets to work with it productively. However, the technical barrier can actually be lower for simple stuff (i.e., the type of stuff a beginner or simpleton would likely write). Open a new solution, hit F5 — blammo, you have a working web app.

    I would almost argue that the barrier to entry is probably about the same regardless of langauge — you have to learn a syntax, learn a toolset, learn a DB. The difference is that with PHP, a crappy programmer with the proper aptitude can potentially become a halfway decent programmer in a relatively short period. With .NET, the bad programmers don’t drop out so much as they just spend a LOT more time writing crappy code until they hopefully one day figure it all out. I’ve been working in large .NET shops for several years now — believe me, it does not take a ninja to get a .NET job these days, especially given the increasing demand (at least in Austin).

  2. The link on my name goes to Gadgetopia. Did I miss a press release or something? When did I start writing for you guys and why didn’t someone let me know? :)

  3. As someone going through that painful transformation from spaghetti code to delicious ninja goodness, I have seen both sides of this argument… And I completely agree.

    If anyone hasn’t read the original Camaro of Programming Languages, I encourage you to do so, and spread it around… It should be required reading to both holier-then-though trendy language evangelists and “spagethii coders” looking to take it up a notch.

    I just submitted the original PHP: The Camaro of Programming Languages post to Digg, show your support.


    Spolsky is a friggin’ ninja

    Ha! that line alone was worth reading the entire post.

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.