What’s the Deal with PHP?
I write code. I maintain servers. I’ve been doing this a long time, and I’m curious:
Am I that stubborn or are that many people just doing it wrong?
In my professional history I’ve written and/or maintained code in the following languages and/or environments:
- Perl
- Java
- C# / .NET
- C
- Objective-C / Cocoa
- PHP
- Javascript
- Visual Basic
In addition I have at least passing familiarity with Python and Ruby, although my coding experience with them amounts to a couple lines of debugging in each. So I feel pretty well qualified in saying that some technologies are better suited for the ways they’re being used than others are. I know the knock against Perl is that it makes it too easy to write bad programs, but I’ve seen a lot of bad PHP and Java — and I’ve never seen good Visual Basic. The bad Java was in an enterprise-class, critical-level-support-guaranteed application that reliably crashed the server under 1/3 the load the company promised its customers it could handle(1). From the people I’ve worked with I’d say that smart Perl programmers are much easier to find than smart Java programmers are. That’s not to say that there are no smart Java programmers (I know a few), but that my experience leads me to distrust the companies that rely heavily on it.
1) The flaw was in management of a database handle. The database interface was simple, by-the-book Java, and the server would run out of resources. I wrote the testing program that identified the flaw, but other people were responsible for writing and fixing the code. I’m pretty sure it wasn’t a singleton implementation, and I think there were reasons for that, but I’ve long since forgotten why it was built the way it was. All I know is it didn’t increase my faith in Java as an application platform.
PHP, though, just mystifies me. From my experience with it I get the idea that PHP makes it even easier to write bad programs than Perl does. I’ve written a few extensions for PHP apps, and every time I find myself dealing with issues of variable persistence and scope I never have in Perl. I LOATHE the way it handles regular expressions. I don’t see anything in PHP that lends itself to more rapid development than you get with Perl, and I feel like the server lacks the all-around robustness you get with Perl. I’ve also had a harder time debugging PHP than I’d expect(2). Plus there’s the whole mixy-mixy thing with HTML and code, about which my feelings are, well, mixed(3).
2) This probably comes down to scoping, where I expect things to work the way Perl does them, and PHP seems to have its own understanding of when a scoped, private variable should cease to exist (much later than I expect it to, usually). But there were other issues too.
3) The mixy-mixy can be useful, but it can also be hell on earth, but even the useful stuff turns into hell on earth after a few months or years of maintenance and feature requests). When I saw a ColdFusion demo at Internet World ten years ago I thought it was what my company should have been using for its code and I pushed for an implementation of it. Now that I’m older and wiser, though, I just get headaches thinking about managing two different types of code in the same files.
Set me straight, though. Am I just looking at it the wrong way? Is PHP, in fact, awesome? Are Java application servers now more robust than I once knew them to be?
Also also, all the young Turks now either seem to be using Python or Ruby. Python I get. I’ve never written anything in it, but it’s solid, stable, etc. Ruby, though? Seems like yet another solution for a problem you could have solved with, well, Perl or Python (to name two). Is Ruby really all that, or is it just that the young Turks are starting out with it, so they don’t know what else they’re missing?
1 note
