7 ms·
And it is extremely successful because it's not a bad language. Sure, there's lots of "wat", but a non-professional programmer is going to say "wat" about every
by fzzzy 10y ago
And it is extremely successful because it's not a bad language. Sure, there's lots of "wat", but a non-professional programmer is going to say "wat" about every strange error they get from another programming language that js would have just passed silently with a weird result. Then they will replace whatever construct isn't working with one that does, and get on with their life, unlike people who seem to have a lot of energy to waste on complaining.
- themihai 10y agoAre there bad languages? Can you give an example of a such language? I'm also wondering why JS changed so much lately if it was a great language already.
- goatlover 10y agoSure, but there are better alternatives, and now that JS isn't just confined to the web, where it had no real competition, people are complaining because they see it being used instead of better tools that have been available for a long time.
- fzzzy 10y agoES6 is better. [edit] ES6 is definitely better than a swift kick in the groin. It is certainly better than the original version of javascript. And it is also better than a lobotomy.
- falcolas 10y agoBetter than....? A swift kick to the groin? Original Javascript? Lobotomies? "Better" doesn't necessarily imply "Good".
- goatlover 10y agoES6 is definitely a better Javascript. But whether it's better than other languages on the server (or desktop) side is the question. But maybe by ES10 it will be.
- kybernetikos 10y agoI don't think there is universal agreement on what the better alternatives are. If there were, comments like these would list them. There are however worse examples for desktop development never the less used on the desktop like VBA, java, adobe air, scala. As with so many choices, there is a trade off. If it were possible to point to some system that is unambiguously better on all axes than javascript and its ecosystem, then you'd have a point, but since there isn't, we're back to arguing trade offs, and really, getting upset about the tools other people choose to make things is a pretty fruitless use of time and energy. If people really want to encourage others to move, they'd be better evangelising the solutions they love than berating people for choosing what they choose.
- falcolas 10y ago> And it is extremely successful because it's not a bad language. Perhaps not a bad language, but I do think it falls into the same category as PHP - just good enough. It's just good enough to do what we want it to do, and given the lack of choice, we're willing and ready to pile abstraction upon abstraction upon it to try and reduce the pain involved with getting work done. And like masochists, we look at the results and go "Well, that didn't hurt too bad this time, so I'm willing to go do it again."
- Udik 10y agoI don't think you know what you're talking about. PHP, up to version 4 at least, was hardly even a language. More like a collection of macros. Javascript, despite a few ugly gotchas, is an elegant language with a few simple rules that allow for an impressive degree of freedom and flexibility.
- falcolas 10y ago> hardly even a language. More like a collection of macros. You just described Forth, and a good portion of Lisp. Both of which are great, groundbreaking, and productive languages. > an elegant language with a few simple rules that allow for an impressive degree of freedom and flexibility Very eloquently said. However, compared to other dynamic languages like Lisp, Perl, Ruby, and Python, it doesn't strike me as particularly free or flexible. The ability to create and use DSLs directly within those languages really displays true flexibility and freedom, IMO. Of course, you don't always want unlimited flexibility and freedom in a language; it's why a particular type-safe languages with a very restrictive borrow checker is so popular.
- qwer 10y agoDSLs are actually common in javascript. JQuery, one of the most popular libraries in all of javascript is mostly a DSL for DOM manipulation. Lodash/underscore is mostly a DSL for list manipulation. Admittedly, JS doesn't have operator overloading, but I personally think that's a good thing.
- nothis 10y agoI mean, the whole "{} + [] == 0" thing is cute and all, but isn't that just tip-of-the-iceberg hilarity? Isn't the real problem with javascript that it's slow and messy?
- sdegutis 10y agoI was under the impression modern JS interpreters JIT to machine code and are fast. Kind of like how Java was slow in 1995 but today is kind of amazingly fast. Which I guess implies that there are two ways a language can become fast: one is by being designed for speed, and another is by becoming extremely popular/useful and having tons of millions of hours of thought and work put into making it faster.
- kybernetikos 10y agoJS engines have improved by about 2 orders of magnitude in speed for actual use over the last 10 or so years. They've outpaced Moores law.
- goatlover 10y agoProbably because the head guy working on V8 had lots of experience with virtual machines going back to Self in the 80s. But it's kind of silly to say that JS VMs have outpaced Moore's law, given that interpreted JS was very slow to begin with. It's not the same as a compiled languge improving by that much in the same time. Basically, JS wasn't leveraging much of the computer's power until V8 came along.
- kybernetikos 10y agoIt seems that you're complaining about some perceived meaning in my comment, but I'm not sure what it was. Having written significant pieces of code in javascript over the last 13 years, I've benefitted massively from those speed increases, and while I'm aware of a number of reasons that they have occurred (including but not limited to the v8 engine - I remember reading excitedly about tamarin, tracemonkey and the like), I don't think it's silly to point out the sheer magnitude of the improvement. I'm not trying to say that JS is going to save us from Wirth's law or anything, I'm just trying to give people context on what a huge jump it has been.
- noxToken 10y agoWhen I first started learning JavaScript, I wondered how people became proficient at the langue with all these weird quirks[0] that don't raise errors. Turns out that there are a bevy of things to help combat these quirks. Two of them are strict mode[1] (which can be scoped[2] in instances were libraries/frameworks would fail running in strict mode) and linters. Strict mode and linters do not fix everything. This is doubly so if your developers ignore the warnings and errors that the linter throws. The language isn't inherently bad, but plain old JavaScript is not beginner friendly for new developers. It requires the discipline to not just throw things together. [0]: https://dorey.github.io/JavaScript-Equality-Table/unified/ https://dorey.github.io/JavaScript-Equality-Table/unified/ [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [2]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#Invoking_strict_mode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- Udik 10y ago> I wondered how people became proficient at the langue with all these weird quirks[0] (links the usual loose equality table) Why don't you all just use === instead of ==? Tell me, how long does it take to learn it?
- tracker1 10y agoThere are plenty of times where you want ==, or for that matter, any falsy/truthy expression in JS... about the only points where I have issues with some of the defaults for falsy/truthy come down to the number 0... Outside that, I find that there are times where I'm dealing with inputs that can be a string or number, and the coercion can be handy. I would never suggest people start learning programming with JS first... although, there is the huge benefit of not needing more than a text editor and browser (already on their machine) to get started with it. One area of JS that I HATE is Date... it sucks, it's woefully incomplete and moment-timezone is huge to download in a browser. The primitives, coercion and a lot of other bits of JS I really appreciate... but === vs == is pretty low on my list... that said, I tend to prefer the airbnb eslint preset, so it makes me use it anyway.
- nickcano 10y ago>about every strange error they get from another programming language that js would have just passed silently with a weird result Wait, do you mean to imply that "passing silently with a weird result" is somehow better than throwing a verbose, descriptive error?