
Why JavaScript and PHP Won the Web – Outspeaking - lolptdr
http://outspeaking.com/words-of-technology/why-javascript-and-php-won-the-web.html
======
nvivo
Once Javascript started to get popular and it was clear it was the language
everybody would need to work with, experienced people from other languages
started to create libraries and transpilers that would either improve or limit
javascript, and a very open process of "natural selection" started to shape
ES6 and ES7.

PHP on the other hand remains shaped by people that don't understand how badly
designed PHP is and how the decisions that drive its design process are
different from almost any other language.

ES6 onwards may be far from perfect, but it's much more shaped by experience
and good practices than PHP will ever be. This counts a lot, you can currently
design good code with javascript, while even PHP 7 still makes it impossible.

The fact that wordpress websites are 30% of the web masks the fact that there
aren't nearly as many php developers around.

Javascript won the web, PHP didn't. PHP is just another language with
decreasing popularity according to the last TIOBE index:
[http://www.tiobe.com/index.php/content/paperinfo/tpci/index....](http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html)

~~~
tzs
> ES6 onwards may be far from perfect, but it's much more shaped by experience
> and good practices than PHP will ever be. This counts a lot, you can
> currently design good code with javascript, while even PHP 7 still makes it
> impossible.

What are some things that you think make it impossible to design good code in
PHP 7?

~~~
nvivo
PHP itself makes it impossible to design good code. I worked with PHP about 15
years ago, left for other platforms but occasionally had to deal with PHP, and
since the last year I couch a team of PHP developers, so it's part of my daily
life understanding the language and it's quirks. My honest opinion is that PHP
didn't change at all over the years. All the same bad smells are there, but
not at the same places. The best description I've seen for this is in that old
"fractal of bad design" post:

> "PHP is a community of amateurs. Very few people designing it, working on
> it, or writing code in it seem to know what they’re doing. Those who do grow
> a clue tend to drift away to other platforms, reducing the average
> competence of the whole. This, right here, is the biggest problem with PHP:
> it is absolutely the blind leading the blind."

This is so true it hurts, and unfortunately if you think "it's not like that,
every platform has goods and bads, php works for me, yadda yadda yadda" you're
in the amateur group. You need to work with other platforms for real to
understand this. It's not "every platform has issues", it's more like "every
platform has issues, and then there is php, in a different category with much
deeper problems".

This is not about preferences or tastes either. It's just about looking around
and seeing how common problems have already been solved. PHP7 has good
exceptions, yay! Except they should have been there for 20 years. It was
already a _very solid concept_ back when PHP 1.0 was released. ES3 implemented
exceptions correctly in 99 for god's sake. Every other language did too, PHP
is the only kid in the block that took 20 years to understand what exceptions
are supposed to mean in the language.

I could point other small things like the new DateTime API being a joke,
mysqli is still supported and still converts typed data to strings, terrible
encoding support, pure byte strings instead of unicode strings,
inconsistencies in implementations between OSs, the compiler still acting
differently depending on php.ini settings, but in the end, it all boils down
to bad design.

Facebook's Hack fixes the PHP language for real in strict mode, and that is
the work of real engineers thinking about stuff. PHP7 is still the same old
people trying to get around without looking at proven solutions anywhere else.

And that's why you can't design good code with PHP7. It's like trying to
design a good house made of turd. Doesn't matter how much you design it, in
the end it will still smell terrible.

~~~
tzs
C does not have exceptions. Would you contend that good code cannot be
designed in C?

~~~
nvivo
You clearly didn't get the point of the argument. Let's stop here, ok?

~~~
tzs
You are partly right. I missed that you said that PHP7 does now have good
exceptions, so thought that paragraph was saying that the lack of exceptions
prevents designing good code.

But yes, stopping here is a good idea. I don't think we are talking about the
same thing. By "design good code", I mean things like do structured
programming, encapsulation, modularity, clear and reasonably concise
expression of my algorithms, and so on. I can do this in almost every language
I've programmed in except for assembly and teco.

~~~
nvivo
You either program in php and love it, and in this case you're just part of
the amateur group who don't understand what is possible in other platforms, or
you're an experienced programmer who never actually did something serious with
php.

Your concept of good code design is close to what I mean, but even that is not
possible in php.

~~~
tptacek
I'm not sure you're aware of how rude this comment comes across, but: it
sounds pretty rude. Am I misreading it?

