
What if JavaScript wins? - thisisit
https://medium.com/@anildash/what-if-javascript-wins-84898e5341a
======
Someone1234
Mark my words, Web ASM will be just as opaque as traditional assembly
languages. Which is to say that we'll shift the problem from "JavaScript is
bad" to "I cannot debug this," "I cannot see what this script does," "I lost
the original source code, and now I have to reverse engineer WASM! Help!"

WASM isn't a panacea. Much like Flash, Java Applets, and ActiveX it is just
the newest in a long line of Magic Blobs™ that supposedly solve all of our
problems. Sooner or later it will become so complex that even the prospect of
manually reviewing WASM will be seen as more unrealistic than a simple re-
write based on input/output conditions.

~~~
bitsoda
WASM is a compilation target. Think of it as a little machine in the browser
you're writing code for. While you technically could write direct WASM code,
the idea here is to have other languages compile to it, which you could then
debug as normal.

Outside of needing some extreme performance optimization, most web developers
should never need to read or write WASM code.

~~~
rounce
> WASM is a compilation target.

Like the VM in the Flash runtime that runs ActionScript bytecode. Part of the
GP's point still stands regarding MagicBlob™s. That said, it does differ
(massively) in that it doesn't cast the spell of being a closed proprietary
format: primarily driven by motivations of it's owner rather than the benefit
of it's community.

------
bitL
Use JavaScript or its wrappers (TypeScript, Dart etc.) just to glue modules
written in C++ or other sane language, compiled into WASM. That's the future.
JavaScript's role will be diminishing, paradoxically when it is now becoming
an actually usable language, e.g. finally removing callback hell by
async/await, adding some "borrowed" stuff from Scala etc.

------
kapv89
For me, as a founder of a young startup, the overarching benefit of being
proficient in modern JS and sorrounding tooling is that I can use the same
language for my whole stack(servers, web, Android, iOS), and spend more time
thinking about the product and business. In the possible future where the
company grows enough where it needs a distributed server software, the only
part of the product that'd be changing would be the backend, and I'd probably
look at Java for that. For the rest, React(& react-native) + graphql + a
typesystem is a pretty good stack for UI software.

~~~
bitL
You literally restrict yourself to one of the worst languages ever designed.
What could be solved with elegance and without demoralizing your staff in 5
minutes in some other language, in JavaScript it might require "sailing to
Africa and back" to achieve the same (though I must say it has improved a bit
recently from the insanity it used to be). On paper it might look good to you,
but the reality is very different and you are making yourself seriously
restricted in competing with other companies using more sane languages.

Not to mention the web stack changes every single year completely, node has
scalability and versioning issues, and you end up relying on quickly changing
pieces of code you have zero control about.

~~~
kapv89
1\. Can you give me an exam of something that is trivial in another lang, but
requires "sailing to Africa and back" in JS?

2\. What sort of scalability issues related to Node.js are you talking about?
Isn't node.js (thanks to V8, and async IO) much more performance friendly than
other scripting langs?

3\. Regarding web-stack changing quickly, this hasn't effected me on server
side yet. It has effected me on the mobile apps and web app side of things
where I am using react 15.x, but it'll make sense to tackle that after raising
meeting the next few business milestones.

~~~
timr
_" Can you give me an exam of something that is trivial in another lang, but
requires "sailing to Africa and back" in JS?"_

Packages and imports. First-class entities, built in to every other modern
language. A mishmash of different "standards" and proprietary implementations
in Javascript. Even K&R-era C had a better solution than Javascript (until
ES6, anyway).

And do not tell me that ECMAScript 6 fixes this -- as long as there are
multiple implementations in use in legacy code (there are) JS will have to
live with a rat's nest of horrors at this incredibly fundamental level (not to
mention the fact that ES6 imports aren't yet universally supported!)

~~~
kapv89
Agree with you on this one. Module systems are kind of a mess in JS land, and
from the looks of it, will remain so for a few years.

However, from a purely pragmatic point of view, not a deal breaker for early
stage companies.

------
shiado
I used to hate JS because the language is objectively badly designed, but then
I realized that the merits of the language provide a glimpse of the future of
programming.

Most programming problems people have are highly generic, often looking to
implement something completely off the shelf as far as problems go. Wheels can
only be reinvented so many times in so many ways.

To me the JS ecosystem offers a level of high level programming that you just
don't get in other languages. Nothing comes close. There is a package for
every possible problem you have just waiting to be used. You wan't some
complicated auth feature? Consider it done with one require statement and
calling a function to set a configuration. You want some reusable components
for your frontend to solve some complicated issue? Somebody has a crazy React
package doing exactly what you need. Obviously there are security concerns
with this but that is a totally separate topic.

In the future programmers won't be replaced by robots, they will be replaced
by import statements.

~~~
nomy99
"In the future programmers won't be replaced by robots, they will be replaced
by import statements."

I disagree. How is this different from someone 20 years ago saying programmers
will be replaced by jar files.

~~~
andrewmcwatters
Yeah, the reality is some of us got replaced by Adobe and Salesforce.

~~~
nomy99
So you are saying you couldn't apply your skills as a java developer anymore
because of salesforce?

------
captainbland
I think within a few years WASM will finally be in a place where it becomes
usable without relying on JavaScript for interfacing with the web browser and
people will be able to develop high-performance, isomorphic web applications
in other programming languages. This will definitely start to eat into it as
it makes gains elsewhere. As such, I don't really see JavaScript reaching the
level of dominance implied in this article - and to be honest, I wouldn't want
it to when Oracle has gone after developers for naming it as something they
support on trademark grounds.

[https://www.theregister.co.uk/2018/04/18/oracle_ios_app_take...](https://www.theregister.co.uk/2018/04/18/oracle_ios_app_takedown_javascript/)

Honestly, I think JavaScript at some point - not in the near future - will see
its 'Flash' moment where a large organisation stops supporting it entirely if
Oracle keeps up stuff like this.

~~~
abritinthebay
> it becomes usable [...] for interfacing with the web browser

As soon as you add DOM integration... all the things people hate about JS in
terms of architecture and compromises will show up in WASM.

~~~
danield9tqh
I think that's fine because WASM isn't meant to write code in. It's just a
source language for other compiled languages. I'm assuming the javascript
complaints you're talking about are because people actually have to write
javascript code?

~~~
captainbland
Even then I don't think they would tie it to the WASM definition that tightly
as they intend it to be used on other platforms than just web browsers. It
seems to me that you could just have the DOM be expressed as a kind of
interface which the browser implements, and then each language just has a DOM
library which exposes that interface to the programmer.

------
throwpoiu09
To put things in perspective, every decade there is an uber popular so called
simple but highly inadequate non-type checked language that is taking over the
world of novice developers. It's a social phenomenon. Started with Basic,
JavaScript is the latest incarnation.

By the same token, there is also one overcomplicated yet unavoidable
professional language. In that sense, Scala these days has a proud lineage of
C++ and PL/I.

And one Lisp leader per decade for humans who not only perceive human-oriented
syntax as an apostasy and a personal affront but expect that Borg of
parentheses will win any moment now. Hi, Closure.

~~~
TomK32
the border between non-type and type check languages is getting diffuse these
days with typescript going one way and C++ the other way
[http://en.cppreference.com/w/cpp/language/auto](http://en.cppreference.com/w/cpp/language/auto)

~~~
Felk
Type deduction is very different from dynamic typing. It's still perfectly
safe static typing. A better example would be C#'s "dynamic" type. I can agree
with typescript though.

------
hprotagonist
And somewhere, Gary Bernhardt is shaking his head in disbelief.

[https://www.destroyallsoftware.com/talks/the-birth-and-
death...](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-
javascript) was supposed to be satire... but "asm everything" might actually
kind of happen.

~~~
anildash
Yeah, I definitely thought of Gary when I was writing the piece. The first
time as tragedy, the second time as farce!

------
kizer
All the C derivatives are getting closer to one-another. How different are
Typescript, C-sharp, and Java? When JavaScript adds gradual typing, interface,
etc. won't all these languages be nearly the same? The runtimes will differ
but the language features and syntax will be almost the same.

~~~
Felk
I'm not sure if this is a good or a bad thing. On one side we might get stuck
on a local maximum as all languages stick to the universally established
features to be marketable, on the other side it seems that some arguably
objectively useful abstractions crystallize, which makes things easier for
everyone.

~~~
kizer
I think (hope) that Academia, or individuals, would still be able to churn out
"original" languages if there were no immediate need in industry.

------
kartan
The missing point is that other languages have bigger/more specialized
ecosystems.

For the networking effect to exist, your network doesn't needs to be just big.
But it needs to be bigger than the rest. That's why people don't leave
Facebook.

Java, C#, C++, Python have big ecosystems with specialized libraries for
enterprise applications, performance, data analytics, etc.

If any, Javascript is already decreasing its influence in the web. Unity3D
works with C# and it is removing support for its own version of Javascript. Or
your choice may be Unreal Engine and C++. Or you can use Emscripten with C++
to build your own solution.

JavaScript is a language with a lot of problems. The final blow is going to be
WebAssembly, as it will open direct web development to all other languages.

JavaScript will stay with us for long. But I don't think that is reaching its
peak right now.

------
manyoso
If a non-typed language wins, then god help us and I fear for the youth :)

~~~
peterbraden
Why? Just because a non-typed language is dominant, doesn't mean that typed
languages disappear.

------
nawgszy
I am amused by a lot of the hyperbole used against JS, as if it somehow is
hard to use or drastically restricts the problems you can solve.

At this point, I'm not even sure if a single comment in this thread that poses
itself as obviously anti-JS has a valid knock on the language, just high-
level, hand-wavy reasoning about why it is so poor.

------
_pdp_
You are completely missing the point here. It is not the question if
JavaScripts wins - humans are not great at writing software to begin with
regardless of the language. Soon, machine-learning assisted programming will
be a thing and JavaScript will be a non-issue - applicable to any other
language for that matter.

------
kazinator
> _first-ever truly dominant programming language?_

... after Visual Basic.

------
chadlavi
Anil!

~~~
chadlavi
> Finally, there are the networked information sources for news and
> discussion, primary among them being Hacker News. Though it’s notoriously
> the most hostile of these large, networked coder communities [...]

~~~
abritinthebay
I mean... he's not wrong.

~~~
anildash
But it's also got nice folks! :D

~~~
abritinthebay
Absolutely! But there’s a reason a lot of professionals avoid here and call it
The Orange Website in a derogatory fashion...

... and it’s not because it’s overfloeing with kindness & tact.

------
anaheim_ducks
Blazor and similar technologies built on WASM are the future of web dev.

[http://blog.stevensanderson.com/2018/02/06/blazor-
intro/](http://blog.stevensanderson.com/2018/02/06/blazor-intro/)

I no longer read articles on JavaScript or related libraries, it's all
obsolete. I know enough JS and TypeScript to get by until WASM-based tech
takes over, hopefully within 2 years.

~~~
Touche
Given the popularity of Node.js, I doubt this. JavaScript is still winning
when people have the option to use C# or C++ or Scala or whatever else.

~~~
pjmlp
The type of organizations I work on, node.js is only used as requirement for
Web frontends.

Which I anyway avoid thanks the bundlers in Java and .NET frameworks.

~~~
Touche
Unless you're disputing Node.js' popularity I'm not sure how your anecdote is
relevant...

