Tim Bray On PHP

Tim Bray has an interesting post on PHP. He says,

If you want your ears bent back, have a listen to Zend CEO Doron Gerstel; he’ll tell you that half the websites in the world are powered by PHP and that there are 2½ million developers

And goes on to say,

So here’s my problem… all the PHP code I’ve seen… has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places.

Well, there’s a reason for that. Of the 2.5 million PHP developers in the world, probably over 2.25 million are clueless. There’s actually no reason why you can’t write great software (and it can even be quite maintable too) using PHP - the latest version, in particular, has perfectly usable object-orientated features. Wordpress is a nice example of a great PHP app. But that doesn’t take away the fact that most PHP developers are clueless. For some reason, people that have no idea how to write software, think that PHP is the best thing since sliced bread. For that reason, I don’t buy the assertion that “the war is over”, and that “PHP won”. In any case, what the hell is this war? There’s more to software than HTML front ends to mySQL databases.

I actually don’t mind PHP as a language (for simple projects), even if the syntax is a bit silly. I much prefer Java, though. And if the Java community maintains a relentless drive towards making it simpler and more productive to develop fabulous software - not only on the server, but also on the client (for example, I dig the idea of new Java Web Start module for Netbeans 5 - just released as a beta) - then Java will only get stronger.

Comments

  1. Dominic Mitchell wrote:

    Wordpress is an example of _good_ PHP code? You’re kidding, right? I switched from wordpress to typo (which uses rails), simply because I couldn’t maintain my own changes to it. Oh, and like pretty much all PHP apps out there, it’s 100% wedded to MySQL, which I’m not.

  2. Dominic Mitchell wrote:

    Sorry, I just wanted to clarify. I think wordpress, _as seen by a user_ is a fantastic program. I just happen to dislike the codebase.

  3. simon wrote:

    Dominic, I agree about the source code! I was just meaning what you meant - that it’s a great application (from the end-user perspective), built using PHP. The reason I mentioned Wordpress, is that I’d said that most PHP developers are clueless; and I wanted to give an example to say that I was well aware some PHP developers are good!

  4. Dave Hodson wrote:

    Wordpress as an example? Are you kidding? Take a look at the installer just as an example.

    It does (at least) the following:

    1. Connects to the DB in the script
    2. Has hardcoded SQL inserts in the script
    3. Mixes presentation in all of this muck (definitely not MVC)

    Sure, you might say that this is just an installer so who cares? More likely, it is indicative of dev methodologies. Stuff like this turns quickly to spaghetti, moving on to unmaintainable.

  5. simon wrote:

    Dave,

    As I said above, I was referring to Wordpress as an example of a great app, from the perspective of end-users. Wordpress is one of the best (possibly *the* best) blog systems around at the moment: it’s not credible to call it anything other than a great app; neither is it credible to call the developers of Wordpress anything other than talented. The truth is, no-one has built a blog system that is much better than Wordpress, in any programming language. Whether the code-base is maintable or not is another matter.

    I’ve resisted doing any custom configuration with Wordpress, because I’ve had bad experiences customising PHP in the past, for exactly the reasons all the PHP detractors on the blogosphere have been talking about. Personally, I dislike PHP for anything other than simple projects.

  6. judas_iscariote wrote:

    Im sorry, but Wordpress code base is really awful,

    examples of really good codebases :

    Cowiki http://www.cowiki.org (PHP5)
    Flux CMS http://www.flux-cms.org/Main_Page ( PHP5)
    Gallery2 http://gallery.menalto.com/

    sadly there are only very few more examples..

  7. L505 wrote:

    If you look into the Smarty source code (smarty is a template engine for PHP) you will also notice that the smarty “compiler” is a hodgepodge of regexes patched together. Real compilers are not based on a bunch of regexes and mashed potatoes patched and glued together.

    However, smarty seems to be popular and it works. It seems that in this age people could care less about the codebase - and they make judgement purely on what it looks like from an end-user perspective.

  8. XxX wrote:

    That’s exactly what I believe, 97% of software is poorly programmed, especially the 3d games and web appz

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*