DEV Community

Discussion on: JavaScript Is Eating The World

Collapse
legosteen11 profile image
Wouter Doeland

Serious question: why do people like JavaScript so much? I thought people found it horrible. Also, because JS isn't type safe, does this mean it's prone to bugs and crashes because of this?

Collapse
bheesma profile image
Bheesma

Now we have ES6 version of javascript that has classes etc., I haven't explored much, but I have seen it makes you write code in different way like other mature programming languages

Collapse
g105b profile image
Greg Bowler

Yes, but we can ignore the obvious flaws and use things like TypeScript to transpile our code rather than admitting there are better tools.

Collapse
ben profile image
Ben Halpern

I don't particularly like JavaScript and wouldn't choose Node by default, but it's not a strict dichotomy. Circumstance is everything and there are a lot of circumstances where JavaScript really is the right choice, mostly because it's ubiquitous and models can be expressed the same across all environments. We got to this point not because of JS's greatness, but because of pragmatism. That can't be ignored.

Collapse
randyhill profile image
randyhill

A few reasons. It's syntax is easy to learn, and it opens the door to both client and server side development. You have to know it to do anything on client side, once you learn that much why not learn Node.js?

It's drawbacks are well documented in "Javascript, the good parts". Typescript will help improve it, but it will never help prevent programmer mistakes anywhere near as well as Swift (for example). But no language is perfect.

Collapse
bluejayoo profile image
bluejayoo

Is has been my experience that as your software gets larger and more complex, the lack of type safety causes more and more problems. That's why we use Typescript to compensate for the lack of type safety in JavaScript. I think that is one of the reasons JavaScript is becoming so popular. It doesn't matter what you develop in if the ecosystem allows everything to be compiled into JavaScript. Javascript and V8 are similar to the Microsoft CLR and Java JVM -- a universal run time.

Collapse
ben profile image
Ben Halpern

Yes. And this is where Elm fits into the ecosystem really nicely.

Collapse
elmuerte profile image
Michiel Hendriks

Except that JVM and CLR are specifications, V8 is an implementation of no specification. There are multiple Java byte code interpreters, multiple JVMs. There is just one V8, and a hack build on top of it called NodeJS. NodeJS doesn't run on any other JavaScript runtime except V8.
NodeJS is like JavaScript as Microsoft VisualJ is like Java.

Thread Thread
dmytrolapshyn profile image
Dmytro Lapshyn

Maybe this was true back in 2017, but now there's a NodeJS build for the ChakraCore runtime as well.

Collapse
wilsonsilva profile image
Wilson Silva

People don't really love it. It just happens to be the only language the browsers speak and they had to learn it. Then it expanded to other systems and things became more interesting. Even with all the improvements, JavaScript still feels hacky.

Collapse
ethan profile image
Ethan Stewart

"People don't really love it"

False, it's my favorite language.

Thread Thread
rudocris profile image
Rudolf Manusadzhyan

And it's the only programming language that you know well, isn't it? =)

Thread Thread
vedrantrebovic profile image
vedrantrebovic

Bingo.

Collapse
damcosset profile image
Damien Cosset

Here is an article I read some time ago by Eric Elliott about static types. Static types doesn't seem to have enough impact on bug density based on his analysis.

I can't speak for anyone when it comes to Javascript love, but there is a quote from Bjarne Stroustrup ( creator of C++ ) that I like:

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

I imagine all programming languages are horrible, if they were not, we would stop coming up with new ones.

Collapse
symbiat profile image
Ajai Khattri

Not all programming languages are applicable to all problems. Also tech changes. A lot.

Collapse
pedro2555 profile image
Pedro Rodrigues

complain != horrible. Javascript is horrible to work with. I complain about python all the time.

Those are diff statements.