4 ms·
Here's the thing, I do know Javascript pretty well after reading Crockford [1], Braithwaite [2], and Javascript Garden [3]. Much of the behavior of the language
by acjohnson55 12y ago
Here's the thing, I do know Javascript pretty well after reading Crockford [1], Braithwaite [2], and Javascript Garden [3]. Much of the behavior of the language is simply too subtle and failure-prone to bother with, especially when working on projects that aren't composed entirely of world-class JS devs (e.g. every project ever). In its full expressiveness, Javascript yields code that simply does not do what you think it does, unless you've memorized the 6 books of material documenting counterintuitive behavior.
I'm with the prevailing industry consensus, that Javascript has some brilliant parts to it, and when used judiciously, and with the right abstractions, it's not so bad. But some of the more subtle concepts in Javascript, logical consistency aside, simply don't make for great programming.
[1] http://javascript.crockford.com/ http://javascript.crockford.com/
[2] http://leanpub.com/javascript-allonge http://leanpub.com/javascript-allonge
[3] https://bonsaiden.github.io/JavaScript-Garden/ https://bonsaiden.github.io/JavaScript-Garden/
- inglor 12y agoJavaScript has changed a lot since. The way we do asynchronous computation (callbacks -> promises and coroutines), the idioms we like/hate, the runtime performance penalty of different styles. It's true that crockford, javascript-allonge and JS Garden are all good resources but they are simply not as up to date as YDRNJS and they're not as covering. This book doesn't cover 'with' in depth or anything like it. It explains idioms that have formed since "The Good Parts" came out - that was a long time ago and a lot happened since.
- woah 12y agoWhat subtle counterintuitive behavior are you talking about? The only things I can think of are == and if (0).
- zxcvcxz 12y agoI don't get it either. The only one that got me was that you have to scale some decimal numbers to whole numbers to multiply them. 0.1 * 0.2 //0.020000000000000004 But this has never caused issue for me except when tried to make a "prime number finder" when I first started using it. If I was going to build some stat site with a whole bunch of scientific data, I'd probably break out the python. IMO JavaScript is just the best language to work with if you're coding web sites or web applications (and probably prototyping custom UIs for anything). Plus you can use multiple languages server side easily, so use the right tool for the right job.
- rtpg 12y agoIf you try to combine object methods that use 'this' with functional programming-style code, you're in for a bad surprise
- woah 12y agoYea, when people try to rebuild all the fanciful embellishments of classic OOP GUI programming in JS, they're going to have a hard time. Unfortunately I've had to maintain this kind of code in the past. Don't use 'this'. I'm afraid that the addition of the 'class' keyword in es6 will make this tendency worse in some programmers. Along with block scoping, it's a feature lobbied for by people who don't actually code much JS.
- orangecat 12y agoAnd that's JavaScript's fundamental problem: it's full of attractive nuisances that have the nasty property of silently doing the wrong thing. 'this', 0=='0'==false==[]!=[], global variables by default, objects that are almost-but-not-quite maps, for-in-oops-forgot-hasOwnProperty, etc, etc.