PHP is bad
Tim Bray says of PHP:
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 that the war is over and PHP won. 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.
I can go one further and say that all the PHP code I’ve written has been messy, unmaintainable crap. It pains me to say that because it’s code that I wrote, and I know how to write code that is maintainable and neat. I do it in Java and Ruby all the time. So why can’t I do the same in PHP? I don’t know, but it seems to be impossible. I rewrote somebody else’s reporting system in PHP last year, and it turned out to be garbage. So then I rewrote that system again, and it was still garbage when everything was said and done.
I do think that one big problem with PHP is that refactoring is extremely difficult. When I have some messy code in a Java system, I refactor it. I find refactoring a lot more difficult to do in the PHP world, and the lack of a tool like Eclipse that facilitates refactoring is a big part of that. I’m not just talking about the stuff under the Refactoring menu, either, I’m also talking about the fact that Eclipse understands your code well enough to tell you about your compilation errors before you actually compile anything. That makes it a lot easier to move things around without having to round trip things to the browser to make sure they still work. And then there’s the fact that Eclipse has a JUnit test runner built in so that once you’ve done your refactoring you can easily run regression tests to make sure you haven’t broken anything.
It will be interesting to see how easy it is to refactor Ruby on Rails applications. The editors are not as powerful as Eclipse is for Java, but Rails is built to be easily testable, and if you take advantage of that you’re pretty well insured for refactoring.
34 Comments