The great design of PHP

The epic post PHP: a fractal of bad design is worth a read. It’s really interesting, especially if you are a PHP programmer. The author of this post deserves a credit for the work he has done, and there’s a lot to learn (though I’ll get to some questionable details next time).

I was thinking about how to approach the design thing he’s talking about. I felt like he was totally missing the point. Probably, PHP’s design is bad from some theoretical, computer science point of view. But it is great from the real life point of view.

The PHP source code for a “hello world” page is literally “hello world”. This is where the design starts, and it’s big. Trivial things are trivial, simple things are simple, then language gets more complex the more you want from it... and one day it gets really complex and you build Wikipedia. It scales smoothly from hello world to that. While there are indeed many quirks in PHP, they are just minor details. But the learning curve thing is a major strength.

In the post, the examples like Wikipedia and Facebook and WordPress are dismissed like they are irrelevant. But it’s no coincidence that they are there. Jeff Atwood poses a question: “If PHP sucks so profoundly, why is it powering so much of the internet?” And I think I know why: because of its great design.

Good design in terms of computer science attracts geeks who usually make tools for geeks. Just look at the list of Python software. I bet my mum haven’t heard of anything in the list. Good real-life design attracts normal people who want to build something for normal people and who desperately want to start building it now. It’s the design of PHP that makes those great products much more likely to happen.

Simple and powerful leads to popular and successful. And for me “popular and successful” is a much better metric of good design than some criteria made-up specifically to make your point.

Next