Stack Overflow released the results of their annual developer survey last week, and for the fifth consecutive year Javascript checked in as the mos...
For further actions, you may consider blocking this person and/or reporting abuse
Im one of the people that cant understand the javascript hype. It's an inheritly weak language with major problems. I come from C++ and javascript is a massive downstep from that. No compiler helping you catch your errors (no, unit test are not an alternative, a type system can prevent whole categories of errors plus semantic completion). Currently I enjoy writing my backend code in Haskell. For the frontend I use typescript which fixes a lot of javascripts flaws but still suffers from leaky abstractions
Same goes for nodejs. Why would you trust you business logic to a slow and unsafe environment? An yes even with V8 JS is slow. You dont want to write your backend in C because of null pointers, then why do you use a glorified text file to run it?
I have a theory:
When people start learning to program, they develop a strong favorable bias toward whatever language they've learned. I think javascript just-so-happens to be the first (only?) language a lot of people learn, so naturally they favor it.
I have a feeling if you sampled a large group of polyglot programmers, javascript would not fare nearly as well.
I would say this is true for me. JavaScript was effectively my second language and I thought first class functions were the coolest thing ever, along with object literal notation. It got me into functional programming which I'll be internally indebted. However the number of issues caused by it are unparalleled (except maybe by our Ruby on Rails project).
Naturally as I learned more and more languages I started to realize that while I liked the way I wrote JavaScript I hated everyone else's for the most part. I also hated my own after about 3 months generally.
Elm is like heaven sent for me. You compile it and it works. That just doesn't happen in js land. More like push it to production and have everyone find the errors. Plus the helpful compiler messages, autocompletion, Auto formatting, and enforced SemVer make it just so plesent to work in.
The reason is flexibility. It has a wide range of utility, from prototyping quick and dirty tiny programs to writing sensibly performant, fairly strictly typechecked production code. Nobody seems to mention the real flaws though: lack of threading (debateable) and large ints.
The language is complex, riddled with undefined behaviour and it takes years of expertise to be able to comfortably work with any non-trivial code base. And it didn't even have lambdas until recently. JavaScript? You can write a function that returns a class. Hows that for flexibility? You can also write a function that automatically adds promise-based methods from a class/module containing callback based methods: bluebirdjs.com/docs/api/promise.pr... and have THAT be optimised by the JIT and run fast. How's that for power?
Try two compilers: Flowtype and TypeScript. With advanced features such as union/intersection types, flow analysis, non-nullable types, mapped types, etc - both supporting a huge subset of the mind-bending flexibility.
Not even close to slow. Certainly blows almost every other dynamic language away (except maybe sbcl and clojure+jvm). With C and C++, null pointers are the least of your worries.
Seriously, I would take a backend written in node than one in C++ any day.
(I'm still waiting for a language to match TypeScript's flexibility when it comes to native record types. Maybe PureScript one day. Or if Haskellers get their act together and add proper row-polymorphic records, Or OCaml/ReasonML objects)
I was talking about Javascript, not Typescript. Those are different languages. I write all my fronzend code in Typescript too, because it has a very nice type system. But it has other flaws. E.g. always infering tuples as sum typed array.
I also would not write a Backend in C++ but I would like it more than a Javascript backend.
And yes JS is the fastest of the scripting languages, but if you achieve 10x speedup with something that was 100x slower, it is still slow.
Also is Javascript horrible on a multi core CPU as it cant use it fully.
10x is the worst case - you would typically get around 2x-3x worse performance compared with most compiled languages. See for example benchmarksgame.alioth.debian.org/u... - and thats with 4 cores vs 1 core for most of the programs. When limited to single core the difference is even smaller.
Oh man you should try Elm if you have a Haskell backed. Typescript might be nice for the stuff that's not supported in Elm yet though. The type system makes a world of difference, it's crazy.
Elm is not a good language. You are at the mercy of it's creators because they decide how your code should work. Elm is simply not a general purpose language.
I want to try Purescript one day though. I looks like Haskell for the Browser
Elm only runs in the browser and is only really made for front end development. However just replacing most of your JavaScript is still very useful to me. I feel that it's restrictions are mostly caused by it's purity. It can't actually do any side effects so it has to have many pure logic functions that the runtime calls. All language creators decide how your code should work.
At it's current state it can't save you 100% from JavaScript but it can do about 95% (for the typical web app). If I can say that 95% of my code is beautiful and runtime error free I feel like that's a pretty awesome deal.
PureScript could be a good option if you already know Haskell. You do miss out on the enforced SemVer and perhaps more developed libraries but those are probably just a matter of time. It might be a better fit for you.
What I mean is that Elm is too limiting. You are forced to TEA, which is a lot of boilerplate and you cannot try your own ideas
I would hesitate to say "no one" enjoys Javascript. I personally love it, but perhaps I'm biased because I too am a web developer, and aside from a 100-level C++ course in college, Javascript was my first and remains best programming language that I use.
A short example of why I hate JS so much.
Recently I concatenated two strings in Java with the || operator (I write SQL often and got confused) and I got a compiler error immediately.
The same in JS, even at runtime it doesn't throw an error, it simply converts the second string to an empty string. WTF??????
Try it: alert("Hello" || " World")
As I said "I write SQL often and got confused" and JS instead of complaining simply does "something". Event if it doesn't make any sense like in this case.
The one and only reason why Javascript is so popular is simply because there's no other alternative languages that's allowed to run in a browser. We have no other options. So, like it or not, if we want to write front-end web applications, we HAVE TO learn and use Javascript. Period. That's the context of Jeff Atwood's quote above.
It's not relevant whether we like it or hate it, whether it is ugly or beautiful, whether it is fast or slow, etc… all of them are irrelevant. Even this Stack Overflow's survey is irrelevant. We still have to use it, as is, no matter what. That's why the planned web assembly is very important. We all should support it. It will enable other languages to be used for front-end web development.
After other languages are allowed to be used in a browser, then we're talking. Before that, there's no point defending or attacking Javascript. It's useless. :)
I learned (in order) C, C++, Java, C#. I liked C# and I used it for many years but then I started to work with JavaScript, it was painful but there was something about it that made it extremely interesting for me. I missed things like the type safety but I also found myself enjoying working with JavaScript a lot.
I started to wonder why it is so popular. My own personal conclusion is that it is so popular because it is an extremely flexible programming language. The JavaScript flexibility is also its weakest point because it can be used for great good or great evil. The best advice I can give to a JS developer is: "With great power comes great responsibility".
I like JavaScript. It has it's warts which are easily avoided. I am a long time developer and I've worked in languages that were better designed. I am actually new to JavaScript. With Node on the backend, I've never been more productive.
Whenever I read about something about languages in programming, I always remember this quote from Bjarne Stroustrup :
What are you talking about? Most of people i know working with JS they are really happy with JS
I don't hate JavaScript, I don't love it either, but that feeling when you move a feature you had written in JS to backend it just feels gooooooood....