PHP

The Zend Framework

The Zend Framework was released a few days ago. This is a PHP5-only web application framework from Zend, “the PHP company.” It has been in development for a long time, but if that had a chilling effect on the development of other PHP frameworks, it’s hard to see. I’m going to go straight for my grim conclusion here: I think many of the other PHP web frameworks in development have no long-term prayer against Zend.

PHP and view/controller separation

Ironic that I find myself defending PHP at a point when I’m making a huge effort to move most of my web coding to Python, but I keep running across mini-rants along the lines of “PHP sucks because it mixes business logic into your HTML.” No, it doesn’t. It makes it possible, sure. But it’s completely avoidable. As The Daily WTF can show you, it’s possible to do screwy things in any language.

Soft launch

I quietly launched my first production Django site today, a replacement for a mess of legacy third-party PHP code. Unfortunately, it’s a members-only service related to my job and so I don’t have a public URL to share. A couple interesting points: the new site was developed alongside the still-live legacy PHP apps, using some of the same data – including a user table that’s used for authentication. django-admin.py inspectdb made model creation fairly easy.

Let's play a game: BASIC vs. Ruby vs. Python vs. PHP

In November I wrote about rediscovering BASIC Computer Games, a book I had when I was learning programming in the ’80s. Flipping through it recently I came across a simple game called “Reverse”: The game of REVERSE requires you to arrange a list of numbers in numerical order from left to right. To move, you tell the computer how many numbers (counting from the left) to reverse. For example, if the current list is 2 3 4 5 1 6 7 8 9 and you reverse 4, the result will be 5 4 3 2 1 6 7 8 9.

Python question: a better urlparse?

Is there a more sophisticated equivalent of urlparse.urlparse() somewhere that knows enough to break out username and password components? Ideally it would return a dict, with keys like ‘scheme’ and ‘host’ and ‘user’, instead of a tuple. Something like PHP’s parse_url(). Paul Jimenez commented on Mon Dec 12 13:09:22 2005: I wrote http://mail.python.org/pipermail/python-dev/2005-November/058301.html about urlparse being broken not too long ago, though I have yet to present my replacement.

Quick, but not dirty, PHP

Though I’m doing more and more work in Python, I still write a lot of PHP code, especially for quick one-off web automation tasks. There is plenty of activity on the other end of the scale in the PHP world now: frameworks like Cake, WASP, Solar, TaniPHP, the forthcoming Zend Framework. All this action is very cool, but doesn’t address the one-page script – and the one-page script is still worth doing right.