3 ms·
Accessibility beats out all other concerns; why is JavaScript so popular and ubiquitous? It doesn't really matter if you like it or not - especially from a 'pur
by dflock 10y ago
Accessibility beats out all other concerns; why is JavaScript so popular and ubiquitous? It doesn't really matter if you like it or not - especially from a 'purity' point of view.
80% of everything is crap.
The weird edge cases in JavaScript are easily avoided when teaching a subset of es2016 to new programmers.
The basics: variables, loops, functions, etc... are all fine. It's got pretty good functional programming support, too, for beginners.
- ivraatiems 10y agoIn terms of "should one be able to use it," no, it doesn't matter whether I like it or not. A developer who works on the web needs to know JS. That doesn't mean newbie who doesn't know what they want or anything much about development needs to know it, and certainly not that they need to start with it. It's not a "purity" point of view, it's an "ease of use for the purpose" point of view. JavaScript does weird things that stymie experienced devs - a newbie hitting them will be completely lost. What's worse, as I said, is that it does these things because it's poorly designed/its design doesn't adequately cover all the edge cases it should, so newbies will learn the wrong information about why things do or don't happen. The edge cases are not easily avoided because you don't know what a beginner will or won't try to do when working on their own. That means that not only might they do an okay thing in most languages that doesn't work in JS, but that they may also do something BAD that DOES work in JS, because JS is weird. For instance, the way JS handles variable hoisting and scoping is bonkers compared to most other languages - not stuff you can avoid while learning to program, and making it easy to learn the wrong practice as a result. "80% of everything is crap" is a good thing to know when doing development work, but it isn't helpful when learning. The goal of learning in this context is mastery of the basics of development; 80% won't be good enough.
- dflock 10y ago> you don't know what a beginner will or won't try to do when working on their own This is true regardless of which language you use to start with. Computing in general is so ridiculously over-complex and constructed entirely of layered kludges, that beginners are going to trip and fall into lots of these crevasses no matter what, unfortunately. The first lesson advantage of being able to start the coding immediately (everyone has a browser) is not to be dismissed. If you try to do this in Python - otherwise an excellent choice - you will spend the first ~day of the course installing Python and explaining about command lines, editors and the REPL. This seems trivial to us, but it's a huge hurdle for many first time programmers. The JS version of this is "go to this URL, then right click and select Inspect. Start typing in the console."
- erikpukinskis 10y agoThis is exactly right. JavaScript was a great beginner language, but it has now been "professionalized" with ES6, requiring insane build chains, transpiling, shims, all this stuff just to run a basic web site. JavaScript has been ruined by professional programmers (mostly Rubyists) who never learned how to use the object model, or how to structure functional code well. So we get ES6 classes and promises and async and all of this junk that makes the language impossible to build and debug. And I say this as a full time JavaScript programmer of ~5 years, after ~5 years of Ruby. I love both classic JavaScript and Ruby, but ES6 is an abomination. node -v v0.12.7
- ivraatiems 10y agoI don't think JS's problems come just or mainly from its "professionalization." The big problems: Hoisting and scoping weirdness; ambiguity around common operators and type comparisons; poor behavior of "this", and on and on, are baked into the spec. JS is bad at its core level, because it is inconsistent and has broken functionality.
- erikpukinskis 10y agoI think all of those things are great. I use this when I need a declarative data structure. I use nested scopes when I need a compositional data structure. Otherwise I use pure functions. Which is most of the time. I love having these three choices and only these three choices. I think class inheritance, promises/async, and other similar features add complexity for little gain. I used to revel in using fancy features. I was so excited when I found a real need for a DSL in one of my Ruby applications. I built it. I felt like a rock star. Then 12 months later I realized I could have wrote the same code, more understandably, with functions and a few arrays to index data. You refer to JS core as "poor" and "bad" which are not very descriptive words. I am sure you have material criticisms but what are they? I read every JavaScript critique I see, and so far they mostly boil down to "it's not C" or "it's not Ruby" or "it's not Haskell". Yah, it's not. It's simpler and unless you are building a compiler or a video game it's often better because of the simplicity. The problem with JavaScript, IMO, is that people come from other languages, don't actually learn how the JS primitives are best used, and prematurely try to extend the language. See Promises, see classes, see async. These are all features that were only added because the developers couldn't be bothered to learn how to use exactly the features you mention. You can argue this as bad usability on the part of JS, but the reason it gained so much traction is not just because it was in Netscape.... These are actually amazingly powerful feature implemented in a small space. As a beginner they are incredibly usable. It's only hard for experts coming from C or Ruby, who are the people wrecking the language with extensions. Lispers seem to get it.
- bbcbasic 10y agoJava is more than accessible enough for beginners. You can download eclipse, jre jdk on Windows Linux and Mac. I think Java and C# are superior languages: (they even have integers as a specific type!!)