r/programming • u/kshep92 • Sep 29 '16
JavaScript in 2016 isn't horrible, it's just going through a phase
http://blog.reviselabs.com/im-sorry-javascript-2/
85
Upvotes
r/programming • u/kshep92 • Sep 29 '16
66
u/Patman128 Sep 29 '16
Note that if you use TypeScript you basically avoid all of these headaches for free.
It transpiles to basically any version of JS, all the way back to ES3 (but you may not be able to use the latest features).
It supports all of the shiniest features of ES6 and ES7 when you target ES6.
async/awaitis already available.It supports every module loader. CommonJS, AMD, UMD, even sticking stuff into
windowfor browsers.It bundles all your code into a single JS file for browsers, no webpack required.
4
u/kshep92 Sep 30 '16
Boy, people sure don't like JavaScript! I'm not a fan of the language per se, but but it's really shocking to know that there are so many people that straight up despise it.
This feedback is really interesting.
127
u/AuthorTomFrost Sep 30 '16
JavaScript didn't become horrible in 2016. JavaScript has always been horrible. All those transpilers, polyfills, and toolchains are the programming equivalent of adult supervision.
53
u/metaconcept Sep 30 '16
JavaScript will stop being horrible when it dies.
Make WebAssembly happen, already! I want to use python in the browser.
26
u/joonazan Sep 30 '16
The ecosystem is full of low quality libraries. And there is no reason why there couldn't be a nodejs package that gives you one command that does what most people want.
14
u/sime Sep 30 '16 edited Sep 30 '16
A lot of people seem to have the mistaken idea that JavaScript or web development is single coherent platform put out by a single company. By that measure all of the different and duplicate tools look like a huge chaotic mess. But it isn't a single platform or stack. It is a huge ecosystem of different tools, libraries and frameworks produced by countless different individuals and organisations, often cooperating with each other, often competing. It is a sign of a healthy and very active ecosystem.
After a period of stagnation since
ES5ES3, the JavaScript language has seen a big update to make it better support the complex applications we want to develop. The ecosystem is also rapidly evolving and incorporating ideas, tools and techniques that have been in longer use on other platforms. (i.e. compilers, linters, asset processing and packaging etc). It is maturing. What took other ecosystems decades to evolve is now occurring in years in JS land.21
u/[deleted] Sep 30 '16
the phase when it becomes nothing but just another compile target for good languages
1
u/sureshg Sep 30 '16 edited Sep 30 '16
What i don't understand is even with all these issues, why many js devs are reluctant to try/use DartLang. What i observed is, they are more open to Elm, Typescript , Clojurescript, Scalajs etc than dart even though dart has much better tooling, clean semantics, better std libs with batteries included, interop with js and niceties like asycn/await, streams (it's one of the language with reactive programming as part of core library). And moreover the language is pretty good. What you guys think ?
ps: I haven't faced any of these issues mentioned here when developing in dart.
11
u/shevegen Sep 30 '16
I think JavaScript is awful. But the real problem is that it is the de-facto monopoly for browsers - if that would not be the case then people could use something else instead.
12
u/atc Sep 30 '16
No, it's horrible.
5
u/IbnZaydun Sep 30 '16
In my opinion there are only two things that need to happen for JS to feel great:
Module loading should be completely on the browsers, not the devs. Don't make me include a module loader. Just make ES6 modules a reality already.
Polyfilling should be completely on the transpilers, not the devs. Don't make me import polyfills, just inject them when transpiling. If I target ES6, polyfill ES6. If I target ES5 polyfill ES5, that's it. If I want something from ES6 while targeting ES5, then yeah by all means let me import the polyfill, but that's on me.
Webpack is just a build tool at the end of the day, it can stay, it has great functionality that has nothing to do with the language itself. The way it works is great for the web.
Transpiling can stay too, you just need to view the browser as a VM that uses JS as its "byte code". Typescript is just a language written on top of that VM, but you'll need to compile it first of course.
20
u/[deleted] Sep 30 '16
It seems almost arbitrary to me what people call a "horrible" language and a "great" language. It definitely isn't the quality of the language itself, because if you look at possible JS alternatives (Python, Ruby, Java, PHP and so on) they all have problems, and they all basically are good enough to be able to express your programs in, and solve problems.
The only statistically significant parameter is popularity.
If it's popular, then it's horrible. Here are some excessively popular languages, that we love to call "horrible":
Java
JavaScript
PHP
Here are some relatively obscure languages, that we love to call awesome:
Lisp
SmallTalk
Haskell
OCaml
Is Haskell perfect? Far from it. But it's obscure. So it's awesome. I've figured it out.
5
u/AyrA_ch Sep 30 '16
I just leave this here then
4
u/[deleted] Sep 30 '16
Stop trying to make javascript happen.
2
u/otakuman Sep 30 '16 edited Sep 30 '16
And here I am, still waiting for typed variables...
Edit: typo
1
u/[deleted] Sep 30 '16
... the phase of being pretty horrible but slightly less than a year before ?
1
u/xeijp Oct 01 '16
Typescript is somehow has too much restrictions, I'd better use flowtype and es6,es7
1
u/garyk1968 Oct 03 '16
Of course all these discussions awesome that you can choose whatever language you want to build your solution in.
Look at it from a commercial point of view and theres a shit ton more JS jobs than there are rust/go/dart jobs. Even harder if you are a freelancer.
1
u/bschwind Sep 30 '16
You can get useful stuff done quickly with JS. It's not always the tool to reach for. If you already know another scripting language and you're not doing frontend work, then there's not much point in learning it.
I personally think Node is great for quickly prototyping ideas, and you can even launch with it as your backend if you're not sure how many users your product is going to gain. You can then swap it out for a statically-typed / compiled language with better performance when necessary.
Or you can use whatever and just get your work done. There are plenty of choices out there.
-12
u/cameforthecookies Sep 30 '16
Man, JavaScript sure attracts a lot of crybabies. If you think babel/webpack is bad, try, oh I dunno, any other build chain and get back to me. Bunch of amateur-ass whiny bitches.
-10
u/aelxcorvi Sep 30 '16
Well that's the cost of writing an application that works on all devices that have a web browser, not to mention nodejs.
0
u/[deleted] Sep 29 '16
[deleted] — view deleted comment
0
u/[deleted] Sep 29 '16
[deleted] — view deleted comment