Wednesday, December 26, 2007

The right kind of bias

I'm stuck with an El Cheapo hosting company for the pro bono coding I do for one of my quirky hobbies. The problem with that--other than the comotose tech. service that will have us switching providers in February, if not before--is the fact that I'm stuck with the sorry excuse for a scripting language known as PHP.

If I were foolhardy enough to allow hecklers for this, my little soapbox, I could count on language Jihadist rebuttals in 5...4...3...2...1...

But I don't. So there.

I fell in love with Java at the tail-end of the dot-com era for one reason: Documentation. Both for internal error messages as well as APIs. Sun's slipped on that recently, and I am not happy about it. But their more slovenly attempts to document an increasingly Byzantine welter of packages, classes and functions is still head-and-shoulders above what's offered by PHP.

Case in point: I fat-fingered the name of the database to which I was connecting. Any rational programmer would expect the code to fail at the line that attempted to connect to the database. But no--never mind I was even a good little geek and had a fail-statement ready in case it didn't connect. PHP didn't even fail when I attempted to execute the query. No, it actually failed when I tried to retrieve the contents of the recordset.

And that, folks, in unacceptable. Bad enough that PHP tries to enforce a half-@$$ attempt at typing--meaning that you don't declare the type up front--the data type is actually set on first use, after which point the type is apparently set in proverbial stone. So, in a sense, the programmer gets the worst of both worlds: All the ambiguity of VBScript/JavaScript, without the trade-off of on-the-fly mutability (convenient for building things like SQL strings without having to cast all numeric values to strings).

Sloppy, sloppy, sloppy. I'd just as soon go back to classic Visual Basic or even C++, were Java not available. I frankly Just. Do. Not. Grok. what anyone sees in this language, much less why it's so ubiquitous on LAMP servers. I have a more than healthy respect for the handiwork of the open source community. Surely there's something better.