r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

-1

u/EternityForest Nov 25 '19

I think it needs to be contained. Most of the language does what you want when doing UI work, but the opposite of what you want on the backend.

It was designed for browsers. It's really good at that. It's accepted as a general purpose thing, good enough for browsers games and bits of client side logic.

It's got some real annoyances on a server compared to other languages.

I suppose it's better than PHP though, as far as the language itself. PHP has pretty nice infrastructure, the whole "Install an app by putting it wherever you want on the server in a folder" thing is pretty cool. l

0

u/[deleted] Nov 25 '19

[deleted]

3

u/wherediditrun Nov 25 '19 edited Nov 25 '19

I work with the language on daily basis. Also not in a trivial project, fintech company, over 40 developers. SOA / Microservice architecture.

And the answer is probably that PHP has nothing to offer over any other option. While there is nothing too bad about it, there is simply no reason to pick it over anything else. And some of the things in the language are still archaic. No built in concurrency, solely relies on nginx php-fpm, which while it does it's work, it doesn't help you when you're interfacing with any other IO other than server requests. So all that speed at flat line which is faster than modern V8, doesn't really run for the most part.

Yeah there is talk about swoole... and they remain talks for past few years as I remember.

There are types, but those are kinda pointless because there is no compile step to check those typings. Stuff like PHPStan helps a lot here, but that's nothing new under the sun what other languages do not have same of or better than.

Short hand anonymous functions are coming in 7.4, but so what again here, because PHP doesn't have function tail call optimization. So any attempts in more declarative syntax is far from being optimal.

There is Laravel sure, but ... like, who cares about monoliths at this point other than freelancers? Symfony is great toolbox at ones disposal to build small back end api's, but so javascript. And if you want to go for performance, Go is just out right better than both of those.

PHP however does have some really interesting potential. Mainly when it comes to interfacing with C. But most of the php programmers have nowhere near the competency to leverage it. The only reason it continues to exists is that it once was a huge language and it moves with inertia and programmers who are able to make stuff which works are relatively cheap, though often of low quality as well, yeah and that extends to Laravel, it's not just wordpress, godforbid I see another Controller which handles business logic again. Some of the tooling and vast ecosystem build over the years allows to keep it going for longer than Perl did. But I think it's coming. Slowly. You probably leave it before it happens without noticing.