⇥ Thoughts for a new year: PHP as the new Java

December 17, 2007
11 comments
 
⇥ Permalink

If one manages to dig through all the noise on the PHP internals mailing list, there’s a strange feeling of caution coming out of the core development team that, for some reason, just doesn’t feel like it belongs in a PHP discussion list.

Historically, PHP has been developed following the scratch-an-itch method: someone has an idea, or needs something that the platform doesn’t provide, comes up with a solution and either discusses it with the rest of the development team, or (in rarer cases, at least in the past) on the internals list and then posts it to the codebase.

This development process makes for some haphazard functionality, and has, in the past, been the source of many annoyances that need to be handled with extreme care—both in how they are fixed and in how they are maintained for backwards compatibility.

However, some of what are arguably PHP’s most interesting and features have also been born out of this very same system—for example:
  • Object orientation in PHP 4 were added almost as an afterthought, and it showed. Despite the many problems that they caused, however, they also made PHP development worthwhile for many people and served as the main inspiration for the development of PHP 5, which, in turn, opened the door to many of the new features introduced by the latter.

  • SimpleXML was perhaps misnamed, still has a lot of limitations and required several point releases before becoming truly usable, but, at least as far as I’m concerned, it’s what makes XML manipulation tolerable in PHP 5. Without it, we’d be stuck with DOM, which, despite using the same underlying functionality, requires, oh, three times as much code.

  •  Type hinting has, more than once, saved my behind. It took it a couple of minor adjustments (e.g.: allowing passing NULL and supporting arrays) before it became truly useful, but without it we’d have a much poorer language from a maintainability perspective.
Overall, the spontaneity with which PHP has been developed in the past is a combination of sheer recklessness (“I’ll commit and deal with the consequences later”) and a process of discovery that improves what is worth improving, while letting the rest wither (but, unfortunately, almost never die).

The recent discussion about namespaces is a clear example of what is wrong about PHP today: not the endless discussion on internals, not the noise-to-signal ratio, but the fact that someone isn’t willing to just jump the gun, commit and let the chips fall where they may. If we continue down this road, I’m afraid that one day we’ll wake up and find ourselves dealing with the new Java: all decisions made by committee, and innovation dead, somewhere in the corner with no-one to care.