Live data from Hacker News

In many ways PHP is just now starting to come into its own

gist.github.com

11–20 of 133 posts

Re: In many ways PHP is just now starting to come into its own

#11
post #6

Earlier quoted context omitted.

How would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser codebase over a couple of decades. The author makes a good point that people like me who ditched PHP in the mid-2000s should probably stop complaining about it since we don't really know the current state of affairs. The problem is when we have languages like R…

Javascript, of all things, wasn't neatly "designed" either. The core language was hacked together in several weeks, by a few developer at Netscape. Javascript wasn't made for large applications. It was made for form checking and rollover menues (some of the earliest examples back in the day) ;) It can be argued that Javascript has many unfixable design bugs, too. Just sayin.

Well that's why I said "even" Javascript. Brendan Eich actually pulled off a small miracle by embedding incredibly powerful functional and prototypal paradigms in JS. It's not perfect, and there are plenty of warts, but JS came out of the gate with a powerful core that PHP took decades to add in a Frankenstein manner.

Re: In many ways PHP is just now starting to come into its own

#12
post #6
post #2

While it's certainly true that PHP is better than it was 7 years ago, that is primarily in the ecosystem and not the language. The language remains as bad as it was 7 years ago, and they seem to be woefully unwilling to actually fix it.

How would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser codebase over a couple of decades. The author makes a good point that people like me who ditched PHP in the mid-2000s should probably stop complaining about it since we don't really know the current state of affairs. The problem is when we have languages like R…

You would have to break it to fix it. Backwards compatibility kills you unless you never make bad decisions. Some languages manage this, eg Lua that has a (long slow) cycle of deprecate, remove on features.

Re: In many ways PHP is just now starting to come into its own

#13

Earlier quoted context omitted.

What you say is very true. PHP is in the same boat that JavaScript is in. Their very severe, yet very inherent, language flaws just cannot be covered up with one library or framework after another. The only real option is to give up backward compatibility, to then throw out every broken language feature, and to then reimplement them properly. Unfortunately for those two languages, that would involve an awful lot of s…

They are doing it, though. For example they have now deprecated the dreaded mysql_, pgsql_ interfaces (including mysql_now_escape_the_string_for_real() and the like ;) for accessing the database in favor of PDO. They will be removed in the future. Lots of projects still use those. Just 1 example of PHP dropping backwards compatibility. It's not quite so bad as you make it out to be.

Deprecation of those awful vendor specific DB extensions is a good start, no doubt. But those are library functions, rather than language features.

Another thing to consider is that PHP developers have a track record of deprecating certain functionality, then a few releases later changing their minds and no longer deprecating it. Some examples of this include is_a, and var in property declarations.

Given how it's still relatively common to see PHP 4.x installations in use today, 10 or more years after they were first released in some cases, merely deprecating some of the broken functionality now won't help much. We'll still see deprecated features in use in 2020, if not well beyond then.

The broken functionality needs to be stripped out completely within a reasonable time frame (well under a year), not merely deprecated and left around for years, if it even stays deprecated. But this involves the PHP community acting responsibly, and going along with these changes for their own good. I don't think we can expect that level of responsibility out of them, unfortunately.

Re: In many ways PHP is just now starting to come into its own

#14
post #3

"Jeff Atwood has stated publicly that one of his ulterior motives with the Discourse project is get people to stop using PHP and start using Ruby." This just won't ever happen. The people that wanted to drop PHP for something else (Ruby, etc) largely did so years ago. The hosting/running situation for PHP is just too basic and easy for people to get in to vs having to 'run a server' (Rails, etc). PHP is still the onl…

Relevant reference wrt this thread: http://www.phptherightway.com/

Re: In many ways PHP is just now starting to come into its own

#15
post #3

"Jeff Atwood has stated publicly that one of his ulterior motives with the Discourse project is get people to stop using PHP and start using Ruby." This just won't ever happen. The people that wanted to drop PHP for something else (Ruby, etc) largely did so years ago. The hosting/running situation for PHP is just too basic and easy for people to get in to vs having to 'run a server' (Rails, etc). PHP is still the onl…

Exactly. I am still using PHP for pretty much all of my projects despite all of its shortcomings. The reason for this is just how easy it is to write simple scripts and deploy them. For most small hobby projects it is just not worth spending hours setting up the development environment required to create a Ruby/Flask/... project when you can achieve the same thing with a single PHP file. And when it comes to deploy it, virtually every single managed web hoster out there supports PHP, so you just upload the file and it works.

I did play around a bit with Flask a while ago and it does feel a lot cleaner and more efficient. But once you actually try to deploy your app you realize that hardly any web hoster actually supports the required Apache extensions and suddenly you end up having to set up your own server and fiddle with config files to get it to work.

Re: In many ways PHP is just now starting to come into its own

#16

Earlier quoted context omitted.

Javascript, of all things, wasn't neatly "designed" either. The core language was hacked together in several weeks, by a few developer at Netscape. Javascript wasn't made for large applications. It was made for form checking and rollover menues (some of the earliest examples back in the day) ;) It can be argued that Javascript has many unfixable design bugs, too. Just sayin.

Well that's why I said "even" Javascript. Brendan Eich actually pulled off a small miracle by embedding incredibly powerful functional and prototypal paradigms in JS. It's not perfect, and there are plenty of warts, but JS came out of the gate with a powerful core that PHP took decades to add in a Frankenstein manner.

Enough with the "JavaScript is a functional language" myth, please. Merely having first-class functions does not make a language a functional programming language.

JavaScript does not promote the use of pure functions, referential transparency, and the minimization of state.

JavaScript does not encourage the use of recursion.

JavaScript has an atrociously broken type system, rather than a robust and theoretically sound one.

JavaScript does not offer pattern matching and other functionality offered by modern functional languages.

In fact, JavaScript goes out of its way to promote a very imperative, non-functional style of software development, even when efforts are made to try to use it in a functional way.

And JavaScript's prototype-based OO is anything but powerful. In practice, it's nearly useless. That's why we see so many JavaScript developers try to fake a class-like OO system using it, since class-based OO does offer what they need and want. But due to the incapability of JavaScript's prototype-based approach, these hacks end up being incompatible maintenance headaches.

JavaScript does not have a "powerful core". It has a rotten core, just like PHP, and it has evolved in a broken manner, just like PHP.

Re: In many ways PHP is just now starting to come into its own

#17
> If PHP hadn't evolved [...]

> But it has.

Honestly, how can languages (what PHP in the end boils down to) possibly evolve?

Example: you cannot bolt OO to it later on, PHP, Perl and to some lesser extend even Python are a testimony to that. It just does not feel right, leads to syntactic horrors and is usually not very performant.

Neither can you modify the syntax. You can add to it. But not much modify existing syntax. For tiny changes all hell breaks loose.

> [...] and feel like they're doing the wider community a service by making declaring a religious war against PHP.

I think the religious-war card is clearly overused. This is not a religious-war, it is an effort by programmers who rather use the best tool for the job then the bizniz/customer dictating them a languages/framework/CMS. PHP will not be fixed, mission impossible, they know it and therefor advocate a retreat-strategy.

The article describes that the community has (be it very late) finally developed some tool, a package manager, that make it slightly more bearable. But the language and its community still suffer the exact same unfixable problems.

An analogy: even in COBOL-land some problems get fixed up until today, but not fundamental language issues, nor community issues.

Yes, I compare COBOL with PHP. Many, or most, languages will someday be 'legacy' languages. Some just a little sooner then others. :)

Re: In many ways PHP is just now starting to come into its own

#18
I'm as cutting edge in the PHP community as any is going to be (having used the latest betas & community-best-practices since 2004).

I still have serious doubts about PHP, and always insist to new developers should learn a (ruby/python/... clojure/...) too.

The main problem with PHP is the language itself. There is no paradigm it does well. If you're into class-ical OO, then the language's type system is a joke (esp. with the lack of co/contra-variance in type hinting).

If you're into dynamic OO, PHP's java leg-humping perpetually gets in the way. There is no meta-classes, monkey patching, etc. everything that should be dynamic is static.

If you wanting functional programming... you have nothing. Literally. The best they've been able to do is a half-baked closure system. Half the library uses references (rather than returning meaningful data) so you cannot compose functions and there is no hope for any kind of collections system (lists, arrays, etc.) that support a typical functional manipulation.

All you're left with is a "dynamic C".

Add to this that PHP is designed to terminate immediately... and you're modern "daemonic" web requirements (concurrency, queuing, etc.) are completely out of the window.

From the point-of-view of "web-scale" application development PHP is a broken toy: both in the sense that talented developers are hampered by it, and in the sense that its execution model is ill suited to the problem.

Re: In many ways PHP is just now starting to come into its own

#20
post #6
post #2

While it's certainly true that PHP is better than it was 7 years ago, that is primarily in the ecosystem and not the language. The language remains as bad as it was 7 years ago, and they seem to be woefully unwilling to actually fix it.

How would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser codebase over a couple of decades. The author makes a good point that people like me who ditched PHP in the mid-2000s should probably stop complaining about it since we don't really know the current state of affairs. The problem is when we have languages like R…

(can't reply to your reply so here goes)

I'd argue that PHP came out of the gate with some pretty powerful properties, too.

They hit a sweet spot of

* Being there at the right time (none of the "good" languages in your book was around or usable for web dev at the time of PHP4 and PHP5 came out)

* Being easy to learn - giving beginners quick rewards.

* Being powerful enough to do quite a bit more than "simple web pages", as you say. This enabled people to "graduate" from "simple web pages" to "web apps". In fact, most of the web was built in PHP (Wikipedia, Facebook, Wordpress runs on 50% of all webpages or so, Drupal is incredibly popular, Magento runs loads of webshops, and on and on). This has not happened merely by accident. I feel it's a bit wrongheaded to suggest otherwise.

* Being dead easy to deploy on almost any webhost (Drop files, hit them with their url, be done - almost no other language delivers this even today)

In all i feel PHP has moved the web forward tremendously. In time, itself has evolved as well. It may not have evolved as fast as one would want.

It's the C++ of the web era, really.

Post reply on HN