Skip to content

Comment on Time for developers to address the chaos of Node.js and NPM

Comments

It's troubling that PHP gets so much shit because it has an extensive if clumsy standard library, where node gets a free pass because you can get whatever doesn't exist from NPM, welcoming any number of security vulnerabilities into applications.

I recently cleaned my NPM cache at work after 9 months, it was 6GB. ES6 is a massive improvement, but Node's standard library is still lacking and the sheer amount of tooling needed to be effective and up to date is too much.

PHP isn't criticized because it has a big and clumsy library. The criticisms for PHP are very clear: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

It is badly designed.

The fractal blog post will be 6 years old in a couple of weeks. I'm going through it again, and __a lot of it is about the big clumsy library__. Some choice excerpts:

There’s no clear design philosophy. Early PHP was inspired by Perl; the huge stdlib with “out” params is from C; the OO parts are designed like C++ and Java

There's even complaints about PHP 5.2, but PHP 5.4 had just been released a month earlier:

If PHP was compiled with --disable-url-fopen-wrapper, it won’t work. [...] Note that this flag was removed in PHP 5.2.5.
foo()[0] is a syntax error. (Fixed in PHP 5.4.)
PHP errors and PHP exceptions are completely different beasts. They don’t seem to interact at all. (Fixed in PHP 7)
There is no finally construct (Fixed in PHP 5.5)
Methods cannot be named e.g. “list”, because list() is special syntax (Fixed in PHP 7)

I'm going to stop there. Not saying any of it wasn't valid criticism or that some of it doesn't apply to this day. Just that too many people, yourself included, are happy to throw a 6 year old blog post at a language that has continued to evolve since. It's also strange that you say it isn't criticized for a big and clumsy library, because in the link you provided about half of the page is complaints about the library.

I'm going through it again, and __a lot of it is about the big clumsy library__.

And even a lot of that isn't fair because PHP has always integrated C libraries directly; which was a huge strength when it was new. A function like mysql_real_escape_string isn't a PHP function, it's a MySQL function ( https://dev.mysql.com/doc/refman/5.7/en/mysql-real-escape-st... ).

Please stop quoting this article. One third of it was wrong at the time it was written. One third is just opinion. The last third is somewhat valid but a lot of it has been fixed since then.

The author never actually used PHP and just collected a bunch of "facts" from the Internet without even testing some of these things himself.

I mean....you aren't arguing JS is a paradigm of perfect design, are you?

It might be a bit controversial here, but language faults aside, I think PHP's model of package management through Composer is better in many ways than NPM, at least in terms of namespacing, and not prefering to define every function as a separate package within its own universe.

If it makes you feel better, there are plenty of us out there who hate PHP and Node :)

I agree. Just beginning work on a react project installs 300MB or so of tooling, and when you throw Electron into the mix, expect a huge node_modules folder.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.