3 ms·
Javascript has 3 serious, fundamental problems. The first is that it's a prototypal language that's been forced into looking like a class-based OO language. Thi
by InclinedPlane 16y ago
Javascript has 3 serious, fundamental problems. The first is that it's a prototypal language that's been forced into looking like a class-based OO language. This leads people to confusion and frustration, much the same as if you were making a burrito and someone replaced your ingredients with pita bread and hummus. If you try to work against the grain by imagining that JS is just another class-based language you will end up thinking that it's some crazy mutant language that doesn't make sense. If you go into it understanding the paradigm and how to make the best use of it you'll get much better results.
The second major problem with Javascript is that it was prematurely standardized due to excessive pressure to ship during development, and thus has a lot of little mis-features and defects in the core language that haven't been fixed due to concerns about breaking backward compatibility. Luckily it's generally possible to avoid these areas of the language without having to compromise your code so it's just a matter of keeping to good practices and of knowing what to avoid.
The third problem is that Javascript is primarily a web technology where it is married to the DOM, and historically browser DOMs have been a mess: non-standardized, buggy, sometimes slow.
Overall the result is a language with a few landmines that need to be tiptoed around but that is still very solid in its fundamentals. Compare that with many other languages that are more polished and yet fundamentally limited in significant ways (such as Java's lack of closures, for example).
The wonderful thing about JS is that because of its expressiveness, power, and advanced featureset, using the language properly becomes a potent self-reinforcing feedback loop, jQuery is one of the better examples of this.
- orangecat 16y agoExactly right. I don't understand why there can't be a Javascript 2.0 that fixes its ridiculous misfeatures, and that you opt-in to with <script language="js2"> or something. So browsers would have to include two interpreters, but they're so bloated as it is I doubt it would be noticeable.
- wallfly 16y agoCheck out Joose, which is an object layer built with JavaScript on top of Javascript, amazing stuff!! http://joose.it/ http://joose.it/ http://openjsan.org/doc/s/sa/samuraijack/Joose/3.011/lib/Joose.html http://openjsan.org/doc/s/sa/samuraijack/Joose/3.011/lib/Joo...
- msie 16y agoHas someone tried to do this? Google?
- silentbicycle 16y agoIf you want to see what Javascript could have become without premature standardization, check out Lua (http://www.lua.org/ http://www.lua.org/). It doesn't get that much hype because it isn't married to the web, but it's popular in other niches, particularly the gaming industry. It's designed for scripting C / C++ applications, but also works well as a standalone language. It's like a tasteful mix of Python and Javascript, but without any of the fat. It's very dynamic, has a small, extremely portable, and high-performance implementation (in a ~200k C library), has prototype-based objects, a JSON-like native datatype, and a better JIT (http://luajit.org/ http://luajit.org/) than any JS implementation thus far. Recommended introduction: Ierusalimschy's _Programming in Lua, 2nd ed._ (http://www.inf.puc-rio.br/~roberto/pil2/ http://www.inf.puc-rio.br/~roberto/pil2/).