Someone on #python posted this. Not sure if it's been mentioned here before, but I don't think so. Interesting read on why PHP is a PITA once you reach the "large project" stage.
They were really sold on it and just couldn't grasp why there would be any problems. Another PHP outfit I visited a few months ago used for for shell type scripting but PHP for their sites. They thought that perl would be too hard..
It does show that large software projects are hard and require decent programmers and a real language, not self-trained html 'programmers' and a toy language like PHP or ASP.
I'm currently rewriting a PHP application in Perl at work. Magically appearing variables and lack of namespaces have been getting on my nerves, too.
Although you may only be able to pry Perl from my cold, dead hands, I've found PHP suitable for smaller apps. I'm currently writing a PHP front end for XML-RPC server. Although I think PHP leaves much to be desired, it's far from the worst web programming system I've used. That honor goes to the Lovecraftian horror know as ASP/VBScript.
As long as strictly front-end display tasks are deligated to PHP, it's a fine system. It's when users try to encode crazy business logic in PHP that teh suck begins. Give PHP a try. You'll laugh at doing string comparisons like this
<?php
if (strcmp(foo, "jjohn") == 0) {
echo "Yeah man!"
}
?>
PHP is a dynamic language that uses clumsy C mechanism for string handling. Bizaare.
In short, I would be happy to work with PHP again for small, GUI things. However, PHP is quite easy to abuse. It's even more poorly suited for larger projects that (critics of Perl claim) Perl is.
Re:PHP is good for some tasks
trachtenberga on 2003-11-01T07:18:24
And why wouldn't you just do: if ("jjohn" == $foo) ? There's no need for strcmp(). If you're really a regex guy, you could always do: preg_match('/jjohn/', $foo).
Re:Scoping
trachtenberga on 2003-11-01T07:40:01
The piece does a good job of showing you ways the you can shoot yourself in the foot while using PHP, but I really think many of these problem can be avoided in any professional development context.
By "professional development context," I mean you are running your own machine and server and aren't on a shared host. On your own box, you have control over all the settings and can make sure all the troublesome ones are turned off, the good ones are enabled, etc. Whether PHP should allow you to use "stupid" settings is a different issue, of course, but PHP tries hard to make things easy for non-programmers and it's hard to balance these two sides.
I agree the lack of consistency in function names is nothing to be proud of, but new functions are being named consistently. Again, whether it's worth it to break existing code to enforce naming standards, is a tough question. Personally, I wish PHP 5 would rename everything the "right" way and provide some backwards compatable aliases, but I doubt that'll happen.
However, the array example is contrived and stupid. If you were to do something like that (and when would that be?), you'd probably just iterate over it using foreach(), so who cares what the internal order is? Perl hashes don't guarantee any order, but I don't see the sky falling down.
I find that I solve the issue of namespaces by creating objects and holding all my "package" variables as instance variables. Therefore, you only end up with a few major objects floating around in the global namespace and whatever "local" variables you're using in your script.Re:Scoping
trachtenberga on 2003-11-01T07:41:37
Shit. I really should have hit preview so I wouldn't have lost my paragraphs. Sorry about that.