PHP was a no-good, terrible, poorly-made, horrific original design for something like powering Facebook. As a result, it needed a lot of good and important improvements.
Or to be more specific, it was a great design for what it was intended to be: a pet hobby project to make it easier to make Personal Home Pages, and was never intended to be a programming language.
The concept of putting out something this bad, and then refactoring for over a quarter-century to make it almost-usable, is exactly the definition of the webdev way.
PHP is not such a bad language. Of course it has its quirks. However bad code is written by a bad developer, not by a bad language. You can write beautiful code in PHP too.
And the huge code base from Facebook is impossible to rewrite it in even a few years. Throwing away knowledge, tools, and tested code.
The old adage about "never start over from scratch" doesn't really apply when there's no feasible way to refactor your way from A to B.
I'm not gonna rehash the full deal, everyone knows the "PHP is a fractal of bad design" article. Whether you think that's an exaggeration of the problem's impact or not, it's hard not to agree that PHP has a lot of features that are counterintuitive, encourage bad coding practices, and make modularity/expansibility of the codebase a real challenge. PHP is fine if you do it right, but it's really a challenge to ensure that a bunch of volunteers are doing it right, 100% of the time. It's not a coincidence that the people who are using mega-scale PHP codebases like Facebook aren't actually running PHP - they've gone through and cleaned up some of the awfulness and run a language based on PHP. Those are the design decisions that the actual PHP standards group isn't competent to make, because anyone who's sane has run for the hills.
Discourse is indeed extremely overengineered, but I don't think the urge to start over on a modern language that has better design features is wrong per se. If you had a web forum written on ANSI C or COBOL, wouldn't you say that at some point the costs of an inappropriate platform or a limited pool of engineering talent outweigh the cost of just rewriting it? You don't have Facebook-level resources to refactor the whole platform, you don't have billions of dollars of sales riding on your software. It's a comment forum. To throw your comment back - if it's just a simple app to display text on a page, why not fix the technical debt and put yourself on the right long-term track?
I think PHP was used an example of a language that is a total train wreck from a technical standpoint (and I don't think many people would disagree with that.) Despite being a train wreck, PHP is still useful and has been a net positive for the tech industry. Plus all the work that Facebook has done in fixing PHP has turned it into something better than it was.
You're spot on. PHP is really bad, but zillions of hours have gone into tools around and on top of the language such that it's actually not that bad to develop in anymore.
Why was all this time spent on PHP instead of doing anything else? I don't have a clue.
> Good PHP code exists, it only got a bad name due to "web developers" with no formal programming education stumbling across PHP and going "aha this can generate my html etc" and then proceeding to make a pile of mistakes.
It got a bad name due to the weird nature of PHP which is still a template engine , no matter how much features you had on top. It's like developing webapps in pure HAML, Jinja or Handlebars.
PHP also has a lot of bad design language wise, due to the incompetence of its creator and early maintainers when it comes to language design.
Like many people, many years ago I learned php. It was easy to deploy, and make simple dynamic websites. Many hosting services provided support for it. I was quite happy to use it for these things.
Then in 2008 I interned at Facebook. At the time, there had not yet been any attempts to improve the language by Facebook itself. Using php in an actual codebase - real world software - made me realize just how terrible it was. I vowed to never use it again. I even presented some of the worst aspects of php in my intern presentation to the executive team. Mark was quite intrigued. At the time there were talks of how to deal with many of the problems, but nothing had been figured out by time I left.
Its deficiencies are too numerous to simply list here, so I'll give you a high level summary (which many have also said similar things). Php is a giant hacked language originally not designed for real software and then features added on. It's syntax is the worst of any used language; it's language features are severely lacking; its implementations are contradictory, confusing, and destructive. In short, it is not easy to read, it is easy to shoot yourself in the foot, it is not able to scale both in complexity and performance; and its libraries are a mess.
It has never been about whether PHP can get shit done, it's that given languages that actually had formal design processes and make your days as a coder a joy, why would you move TO PHP.
I upvoted your comment but I only partially agree. PHP is great in some ways and totally atrocious in other ways. It put bread on my table in the 2000s but I am not looking back. The language is horribly designed. Writing AJAX calls before Google Chrome was even released (let alone its V8 Engine which made JavaScript fast) was no fun either. Any non-trivial web app we developed was slow (everything had to start from scratch with each request) and flooded with a couple of layers of caching which often didn't get invalidated properly.
Now I am a purely backend&desktop developer, I leave web frontends to people who are willing to live in the JavaScript world where if no big framework is released every 5 minutes you have an impression that the Earth stopped spinning. I learnt the basics of React.js the other year and it's a far cry from what we had 20 years ago. ClojureScript+React even with its difficulties must be an ivory tower of modern web frontend development. I want to remember the good parts of PHP, frameworks Nette and Symfony with nostalgia. But I never want to re-live it again.
I mean Request/Response websites with a bit of AJAX still work today, I even develop one as a side project since I am part-time involved in academia (neural networks & nature-inspired algorithms simulator, in Common Lisp with cl-who, Parenscript and a couple of custom components based on HTML5 Canvas). But modern development? When you need to keep up with the latest trends? No way it can work.
It does matter when you have to work on an existing PHP project that makes throwing yourself off a bridge seem an attractive proposition.
Yeah, it's not entirely the language that is to blame - the language didn't design and code the project after all - but its own design makes it too easy to create stuff that will really punish more seasoned developers later on.
That it powers some popular products or websites isn't entirely relevant, unless we're saying that Wordpress, Wikipedia, Facebook, etc. are popular because they were written in PHP.
Yet the fact of the matter is that's how the cards fell - we had the well-designed, well-implemented languages and frameworks that failed utterly to find any foothold with amateurs and beginners, and only found refuge with the Java EE-enabled engineers.
And then we had PHP.
I'm inclined to side with the parent poster - yes, PHP has a lot of problems when you attempt to make it overly complex, but on the other hand it has introduced many people to programming who would otherwise never have even attempted (or even be able to), and driven ubiquitous web scripting forward single-handedly. Heck, even today, think about someone trying to run a blog - anyone reasonably experienced with a computer can buy hosting and install WordPress with almost no work... try that with anything written in Python?
PHP has a very low barrier to entry, and IMHO a lot of the hate directed at it is frankly jealousy. We are jealous, as professionals, that it is deadly simple to replicate some of our hard work, and that the people doing it are amateurs. This is the same reason people heap hate on VB.
I'm inclined to compare PHP to MySpace - yes, MySpace pages aren't pretty, in fact a lot are downright atrocious. You can make some specious claims about how MySpace-inspired "web design" has made the internet a worse place, somehow, but it would be a pretty thin argument. At the end of the day, both PHP and MySpace opened up a world of possibility to a lot of users who didn't have it before; picking at it really is just being pretentious and elitist.
Ah, it's like old times again. Nowadays all the language-snob threads are directed towards JavaScript, but I remember the days when PHP was the language of choice for what HN considers the inferior programmer. Fun memories, all this thread is missing is a link to the fractal of bad design rant.
The bad rep is totally deserved. PHP, for most of its existence, has been a profoundly bad language per se. That doesn't mean nobody's ever built anything valuable on top of it, and I fully understand that (much like also-justifiably-maligned JavaScript) it's evolved quite a bit. But the points made in this mid-2012 article are absolutely spot-on in describing precisely why PHP absolutely earned its reputation: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
Around 2001 I felt jaded with the industry and determined to do whatever was expedient to earn money. That meant using PHP, because that was purportedly the place to be at the time.
I have never felt so uninspired by a language. My overwhelming feeling from the get-go was that it was a collection of libraries, which would be fine -- but why create a new language?
PHP has the rare distinction among languages of not containing any novel features or ideas. Not only that, but it borrows liberally from several other languages, resulting in an overabundance of syntax. Instead of a tool for attacking problems, it's a reheated leftover. There is not suggestion of a better or worse way to accomplish some goal.
Finally, the original premise of PHP, interspersed functional code and HTML, is high on my list of really bad ideas. Code written in this style is doubly-challenged in terms of reuse and maintainability. Again, there is again no semblance of better or worse with this approach. If you had Richard Stallman and Linus Torvalds produce the same website with PHP, there would be very little in common between their approaches.
Given the success of Facebook et al, I presume that the interspersed code/html thing has been superseded, and further that the egregious security issues in PHP have been fixed. But the picture in my mind's eye is something that lumbers along despite its thorough mediocrity. I will allow that making PHP adequately consistent and secure are impressive feats.
This. PHP is PHP just like Javascript is Javascript. Their growth process was a bunch of people needing things and just implementing them one by one without a grand design. It kinda works, but it'll never be Good in a theoretical sense.
Disturbingly for us language geeks, it doesn't seem to matter at all that they're not very good.
PHP started out as a personal project, not with some grand design to be one of the most used languages powering websites. So yes, there were things about the language that were objectively bad, and it'll never be completely on par with a language that was truly designed from the ground up, but so what?
Your knowledge and the requirements of the job should dictate the tools you use - not what's hot. If it works, scales to the extent you need it to, and can be secured, then great!
PHP was a no-good, terrible, poorly-made, horrific original design for something like powering Facebook. As a result, it needed a lot of good and important improvements.
Or to be more specific, it was a great design for what it was intended to be: a pet hobby project to make it easier to make Personal Home Pages, and was never intended to be a programming language.
https://en.wikipedia.org/wiki/PHP#Early_history
The concept of putting out something this bad, and then refactoring for over a quarter-century to make it almost-usable, is exactly the definition of the webdev way.
The result is a ton of churn.
reply