3 ms·
>> In the recent time I've often read posts about people suggesting: learn language X to a reasonable proficiency before you criticize. Hard to disagree with t
by w0utert 14y ago
>> In the recent time I've often read posts about people suggesting: learn language X to a reasonable proficiency before you criticize.
Hard to disagree with this. That said, I think even JavaScript guru's generally agree that the language itself is actually pretty awful unless you know all of the legacy quirks and WTFs it is dragging along.
When discussing the merits of programming languages, the observation that "JavaScript is the best we have for browser-based development" or "it's possible to write really awesome things with JavaScript" just doesn't cut it for me. Either you acknowledge and accept JavaScript's deficiences and don't try to sugar-coat them, or you refrain from trying to objectively rank it against other languages at all.
My personal opinion is that you simply cannot reasonably maintain that JavaScript is a 'good programming language', for the simple fact that before can say you are proficient with it, you likely have had to deal with multiple WTF's you'll never run into with (most) other languages. Other dynamic VM-based language exist that are much better than JavaScript, but just like the QWERTY keyboard layout, we're stuck with it.
- user24 14y ago> I think even JavaScript guru's generally agree that the language itself is actually pretty awful unless you know all of the legacy quirks and WTFs it is dragging along. Are you confusing pure JS with DOM APIs and xbrowser quirks? Pure ES5 (or 6) is actually a very lovely language to work in, and now thanks to Node, we can. Maybe I'm just so used to the quirks that I don't see them as a problem any more.
- cygx 14y ago> Maybe I'm just so used to the quirks that I don't see them as a problem any more. To jog your memory, here's a list of questionable design decisions I can think of off the top of my head: Automatic semicolon insertion and a broken == operator A language shouldn't try to guess the programmer's intention, but rather fail cleanly on ambiguous cases. Function scope and global by default Frankly, I'm appalled by how many dynamic languages get it wrong. Lexical block scoping with mandatory declarations are by far the most sane approach I've come accross, and the only P-language (Perl, Python, PHP with Ruby and Javascript as honorary members) that gets it right is (strict-mode) Perl. Weird object system While actually protypal, the constructor-with-prototype-property semantics add a pseudo-class based overlay without an obvious mechanism for object extension and code reuse.
- jeswin 14y ago- Add semicolons, if that's what you prefer. - If you needed type checking, use ===. - Function scope and object system, what's wrong with it? These things don't matter in practice, although we could go on arguing about them. If a language has basic hygiene like first class functions I can build apps with it.
- cygx 14y ago- Add semicolons, if that's what you prefer I do, but others disagree. My point is that when parsing fails, insert a semicolon and try again doesn't look very appealing from my personal criteria of language design. - If you needed type checking, use === Which was added to the language after it was realized that the original semantics of == might not have been that well thought out. - Function scope and object system, what's wrong with it? Block scoping provides a finer level of encapsulation than function scope. Do you think `let` was added to the language (JS1.7, ECMA6) just for the heck of it? As for the object system: Instead of using one of the well-known approaches (protoypal with cloning or class-based with inheritance), JS comes with a weird hybrid system inferior to both. Of course JS allows both approaches, but does not provide syntactic support for either, which makes them clumsy to use and open to fragmentation.
- w0utert 14y agoIt's very easy to brush all of these as "don't matter in practice" or "just use <insert sane equivalent of ...>", but if we go that route, almost any language can be considers 'good enough' to write code in. I see 2 problems with this point of view: 1) Ever programmer sometimes makes mistakes, such as forgetting a semicolon, or writing '==' instead of '===' 2) This assumes that anyone writing JavaScript knows about all these gotcha's We can sit here all day arguing about 'how bad' some of the things JavaScript does or does not, but that's not the point. Most other languages have none of these issues, and if tomorrow somehow all browsers on earth would magically be able to run some kind of clean alternative to JavaScript, I'm pretty sure everyone would immediately jump on it.
- blablabla123 14y ago> Hard to disagree with this. That said, I think even JavaScript guru's generally agree that the language itself is actually pretty awful unless you know all of the legacy quirks and WTFs it is dragging along. Sure, Crockford is probably the best example. But the same is true from many languages that became popular before 2000. C is notorious for its pointer magic and buffer overflows. C++ is notorious for being an "expert language" that takes years to master. Java is hated for being very verbose. I know someone, long term (Ex-)Rubyist, hating the language for not scaling well and being hard to debug. Maybe I'm too pragmatic but I think in every language there is something to hate. (Haven't seriously tried C# though ;) I think at the end of the day the libraries make up at least 50% of the overall language experience. In the recent years JS has got a number of high quality libraries like jQuery or underscore.js that transparently circumvent many behated JS features. Like awkward checks for undefined or consistent and easy DOM manipulation. IMHO C++ is a good example for a language in which libraries can hardly make up for the deficiencies because the language is so complex. JS on the contrary does not have so many rules.