Having read “PHP: a fractal of bad design,” I had experienced a brief moment of identity panic – since it was an intelligent writeup, and most of my code these days is written in PHP. It stung and it took me a few moments to reel my thoughts in. I agreed with many of @eevee‘s points, notably ones having to do with internal consistency and predictability. PHP is very weak there. But is this really a problem?
Nah. It’s precisely what makes PHP successful.
Qualities of a successful, widely-adopted language are more evolutionary in nature than predictability, consistence and reliability. A successful language needs to have a set of random, favorable and naturally selectable traits that embrace variation, mutation and adaptation. Let people choose naturally between two function names. Show some dead skin every once in awhile, to remind us of abandoned practices. Make the hosting environment as wide and welcoming as possible, despite its unpredictable behavior and perils.
You can’t control design of an organic system after the fact.
If you apply @eevee’s arguments to our own bodies, you come up with very similar questions that he posed. There are things that simply don’t make any sense. Why do men have nipples? Where’s the manual? What’s up with the tailbone, and all the unnecessary hair? Appendix: what does it do, apart from bursting at random and trying to kill you?
Well, so it just happens that PHP developed organically, leaving vestigial parts in place throughout its many years. These questions of language design and its design order are of no consequence; they are direct results of a hive mind trying to improve upon itself and fix its errors. Might as well expect a proposal for mail() to be replaced with tweet() in the coming years. But, PHP’s userbase is huge and its negotiated design is a slow process, making it frustrating enough for that reason alone. This is normal.
Predictability, consistence, brevity, reliability are a set of naive ideological principles. While it’s nice to want something be consistent in design, it’s important to keep in mind that successful languages do change, are meant to change and are frustratingly unpredictable at times. The English language is slowly changing: it’s ever-fluid, inconsistent, but somehow popular. On the other hand Latin: the beautiful, semantic, predictable, conjugable language is very much dead. You know, like Cobol. We can read and write Latin, but we don’t know how it was pronounced, though the Vatican’s practiced fork is a good starting guess.
No, there is no direct correlation between a language’s design and its success, whether spoken, written, or programmed in. But PHP is frighteningly successful, given its flaws.
Change must be slow.
There’s a direct correlation between radical change (by ways of a rewrite, redesign, reinvention) and people’s aversion to it. This applies to anything, but especially computing innovation. What usually appears to be a well thought-out redesign of an existing product or service is usually met with heavy rejection. Innovating too hard is counterproductive, because the change is too sudden, too alien – and you won’t get the adoption rate you assumed you would, even though your new system is organized better. Should you break dependencies, like Python’s 3.0 rewrite, you’ll fragment your userbase and stall your overall progress.
No language is perfect, but their learning curves are responsible for their adoption in the market. Which is pretty much why I started using PHP nearly a decade ago- it’s more familiar to the C/java group than either Python or Ruby, and it’s much easier for beginners to pick up. Best yet, from year to year PHP hasn’t changed so drastically as to create severe disturbances. Thus, I can bet on its longevity.
PHP will be just fine.
Computing world and web development strategies are changing – we’re moving away from desktop apps and embracing a centralization of sorts. In this slow process, the lines between server and client are disappearing, and especially the line between web server and programming language. Coupling the two is practical for managing and scaling assets, and I predict that we’ll see a popular PHP-apache-nosql package fusion in the coming years. However, the language itself will likely remain just the way it is, charmingly quirky.
PHP is wild, and that’s the nature of life.