TranslateProject/sources/tech/20160830 The State Of JavaScript - JavaScript Flavors.md
2016-09-04 22:17:47 +08:00

6.0 KiB
Raw Blame History

The State Of JavaScript: JavaScript Flavors

One thing that distinguishes JavaScript from other programming languages is that JavaScript isnt just one language: its actually more like a family of closely related cousins.

What started with CoffeeScript back in 2009 has become an explosion of choice over the past couple years: ES6, TypeScript, Elm… they all have their strengths, and they all compile down to good old JavaScript.

So after last weeks look at front-end frameworks, lets look at what the State Of JavaScript survey can tell us about JavaScript Flavors.

Disclaimer: these are preliminary results extracted from a partial dataset. Theyre just a way for me to share some insights while I take my time to come up with the best way to present the complete results.

Note: if you havent taken the survey yet, now would be the perfect time to do it! Itll only take 10 minutes and you can come back here after :)

Awareness

First, I wanted to find out the percentage of respondents that were aware of each of the six options existence:

  • Good Old Plain JavaScript: 97%
  • ES6: 98%
  • CoffeeScript: 99%
  • TypeScript: 98%
  • Elm: 66%
  • ClojureScript: 77%

You would expect that “Good Old Plain JavaScript” would score 100% awareness, but I imagine some people couldnt resist the temptation of picking “Ive never heard of JavaScript” in a JavaScript survey…

ES6, CoffeeScript, and TypeScript all have near-perfect awareness, which surprised me since TypeScript isnt quite as widespread as the other two.

Elm and ClojureScript on the other hand have much lower scores, which makes sense since theyre more tied to their own ecosystems, and harder to use in existing apps.

Interest

Next, lets look at which flavors have been generating the most interest among developers who havent used them yet:

Remember were looking at non-users here, so it makes sense that there would be very few people who havent used Plain JavaScript.

Its interesting to look at ES6: a large proportion of developers have already jumped on the bandwagon, and almost all (89%) of those who havent yet want to learn it as well.

TypeScript and Elm are in the same boat: not many people have used them, but they have 53% and 58% interest scores respectively, which isnt bad by any means.

If I had to guess, Id say that both TypeScript and Elm might be having a hard time articulating their advantages to the average JavaScript developer. After all its hard to understand the advantages of something like static typing if all you know is JavaScript.

Also, few developers have used CoffeeScript, and apparently almost nobody wants to learn it. There goes my plan to write a 12-volume CoffeeScript Encyclopedia…

Satisfaction

We now come to the key question: how many developers have used each specific flavor, and how many would use it again?

While plain JavaScript has larger usage numbers as expected, in terms of satisfaction the big winner here is ES6, and I think its safe to say its now the default way to write JavaScript apps. TypeScript and Elm both also have similarly high satisfaction percentages, around 85%. And once more, poor CoffeeScript trails the poll with only 17% of developers willing to consider it again.

Happiness

Finally, I asked people how happy they were with their current way of writing JavaScript:

The high scores we saw in the previous question are confirmed here: with an average score of 3.96 overall, people are really happy with JavaScript as a language.

Its hard to say if this is because of JavaScripts recent improvements, or because maybe (just maybe) JavaScript isnt as horrible a language as people make it to be. But its certainly comforting.

Conclusions

If React and Vue were the clear winners last time, I would say that here its without a doubt ES6. This is not groundbreaking news by any means, but its nice to know the community is embracing the direction the language is taking.

It will be really interesting to ask these questions again a year or so from now, and see if TypeScript, Elm, and ClojureScript have made any progress.

Personally, I suspect this explosion of flavors is just the beginning, and that the way we write JavaScript a couple years from now might be quite different!

Share the Word & Stay Tuned

When it comes to surveys like this one, more data equals better data! The more people take the survey, the more representative of the overall JavaScript community it will be.

So if you can, I encourage you to share the survey:

On Twitter

On Facebook

And if youd like to know next time I publish results, head to the survey homepage and leave your email there to be notified!


via: https://www.oreilly.com/ideas/spark-comparison-aws-vs-gcp?utm_source=dbweekly&utm_medium=email

作者:Sacha Greif 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出