23 ms·
JavaScript is Good, Actually
- analognoise 8y agoThis post even argues against the very idea that JavaScript is any good. {Garbage code example} "Syntax is just syntax". "Tool writers are neutral, then get to work fixing this terrible language". Really?
- abritinthebay 8y agoWell I mean if you misquote and make up what the article said you can argue anything
- rootlocus 8y agoRegarding the same code example > You may have noticed that the code above isn’t even JavaScript, it’s TypeScript, which brings me to my next point. Which kind of invalidates the entire premise of the article.
- the_duke 8y agoNot really, Typescript is mostly a superset of ES2015 and is compatible syntax wise. It has almost no new "features" (apart from enums and namespaces, I think) and only contains a typing + visibility system and related syntax on top. The only part that is not ES2015 in the given code example is the ' as ConsignmentSetup' cast.
- chc 8y agoAFAIK async functions aren't part of ES2015 either.
- STRiDEX 8y agoasync functions are es2017 async generators are es2018 but both are supported in the latest version of node v10 http://node.green/#ES2017-features-async-functions http://node.green/#ES2017-features-async-functions I had to look it up because i could've sworn async functions were es2015. The lines get blurry when things are implemented out of order.
- repolfx 8y agoBy that definition C++ and C are the same languages. But everyone knows they aren't. And both C/C++ are statically typed languages! You can't just drop a static type system into a scripting language and claim it's an irrelevant difference! I agree with the other posters - there are probably good defences of JavaScript that can be written, but writing an article about how great JavaScript is and then showing a code sample from a different language just reinforces the idea that JavaScript developers probably don't have much experience with other kinds of programming.
- deleted 8y ago[deleted]
- rootlocus 8y ago> Not really, Typescript is mostly a superset of ES2015 and is compatible syntax wise. You could say that about C++ and C, but that's an entire different can of worms. So why not give the example in JavaScript then? Arguing that JavaScript is "Good, Actually" and then showing examples of tools people have build to avoid using vanilla js because it lacks X or Y is actually an argument for js being "Not Good Enough".
- Axnyff 8y agoasync await are ES2017 though
- cprecioso 8y agoI agree that the writer shouldn't have used TypeScript to demonstrate JavaScript; but to be fair, the only thing you have to do to turn it into JS is remove the `as ConsignmentSetup` on the 4th line.
- rootlocus 8y ago> the only thing you have to do to turn it into JS is remove the `as ConsignmentSetup` Removing the cast means removing static typing. It might be a small change for this snippet, but at the project level, you'd need considerably more changes, and you'd lose type safety.
- bonesss 8y agoYeah, arguing that language features that have caused untold pain, constant confusion, and an shameful level of strictness aren't an issue because third-party linters and typed DSLs give you warnings is... weak. Any language can address any issue in that manner. The very fact 3rd party tooling is required to address language design issues is a pretty harsh criticism of that languages design in and of itself. Javascript the language is getting much better, and is quite nice in many dimensions. Javascript the ecosystem has a lot of strengths, while also having embarrassingly poor base libraries that require stupid levels of duplicated effort and a platform that is still painfully inconsistent. The fragmentation around Coffescript/Typescript and linters hints at a much stronger need for a language that does more than JS does at its core... As traditional languages encroach into the browser space I see a lot of the "SPA" and cutting edge fat-client-in-html moving away from JS because of those warts.
- gcommer 8y ago> Yeah, arguing that language features that have caused untold pain, constant confusion, and an shameful level of strictness aren't an issue because third-party linters and typed DSLs give you warnings is... weak. The point the author is making is that the haters love to point at these quirks and claim that they cause "untold pain"; yet in actual practice I've only been bitten by == maybe twice in 15 years.
- bonesss 8y agoNo, the point the author is making is that a painful, well-known, common irritant which bites people in the ass on the regular (source: https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons https://stackoverflow.com/questions/359494/which-equals-oper...), is avoidable with secondary tooling. Issues that even bite people with 15 years experience in the language... This argument applies equally well to using PHP for most anything. Not impressive.
- worldsayshi 8y agoSwitching back to Java after having spent a long time in JavaScript land with modern standards made me realize how great JavaScript had become. The biggest reason for JavaScripts greatness to me is JSON. I couldn't understand how Java developers put up with such bulky ways to deal with data. After some time in Java land I've come back to appreciating its strengths again though. Code completion is nice. I'm kind of hoping for more typescript in the future.
- osrec 8y agoI too like JSON, however it is somewhat inefficient for arrays, where you end up repeating keys a lot. If you're gzipping, it probably doesn't matter as much...
- tim333 8y agoI'm slightly puzzled. Array = [[1,2,3],[4,5,6]] seems valid json and I'm not sure what's inefficient or where the keys come in?
- zinckiwi 8y agos/arrays/"collections of homogenous objects" and it's a fair point.
- osrec 8y agoI was thinking of arrays of objects, where the keys are repeated for each object in the array.
- Secretmapper 8y agoI'm still a bit confused how this is a problem. Can you elaborate? Is there any serialisation standard that specifically addresses this? I know YAML and TOML doesn't at least (correct me if I"m wrong)
- 8y ago
- hardwaresofton 8y agoI think javascript shines only depending on which languages you compare it to, and what you're doing with it. Also JS + Typescript is a force to be reckoned with (the added safety is great), and once a multi-threaded runtime like Chakra[0] takes shape, it'll be even better. JS's early introduction of concurrency primitives (callbacks, futures/deferreds, promises) will make javsacript developers much productive much faster than the equivalent ruby/python 2 developer with not as much early exposure to managing concurrency.
- Clubber 8y agoTypescript is the only reason I would consider Javascript "good." Without the type safety and the refactoring tools that type safety makes possible, applications may be easy to write initially, but unbearably difficult and time consuming (read expensive) to refactor and maintain an application of even basic to moderate complexity.
- hardwaresofton 8y agoWhat about: - easy accessibility of higher order functions (AKA functions as a first class object from the get go) - graceful inclusion/addition of concurrency-handling functionality despite the language being single threaded (this might be much more to do with the context javascript was to be used in) I agree with your sentiments on the value of type systems and compile-time type checking, but so many languages are in the same boat as JS in this regard -- it even applies to a bunch of lisp dialects (CL does have the `declare` form), and not many could consider lisp a "bad" language.
- zaarn 8y ago1. We've had higher order functions since 1960s, it's not a new discovery that is singular to JS, that award goes to LISP and Scheme. 2. Concurrent execution has also been introduced in the 1960s (Dijkstra 1965), Ada and Erlang supported that behaviour since the 80s. 3. LISP has a type system and basically any LISP runtime will yell at you for comparing strings with numbers just like that. SBCL can do this check at compile time even. Additionally LISP lets you add a type system on top using macros and other tricks (some going as far as implementing a Haskell-like typesystem in LISP).
- themacguffinman 8y agoI don't mind ES6+ syntax. I'd even say that the syntax alone makes for a pretty great developer experience, but I still wouldn't say it's a great language altogether. I think a fundamental problem with the language is that it's not particularly memory-efficient, and it's hard to make it memory-efficient. The V8 team has done a lot to make it better but they are still limited by the design of the language. That's particularly painful in mobile where memory is constrained, and on the desktop it's making the typical 4 - 8GB of RAM less and less sufficient. That's important when discussing why Javascript is still an issue when using stuff like Electron and React Native.
- roman_g 8y agoOne of the richest companies in the world with very good engineers made a supercomplex engine which nobody understands and looks like they cannot make it better and we use it happily as given - something's wrong here.
- kevindqc 8y agoI don't understand what's wrong? People use software without knowing how it's coded under the hood all the time? The V8 code is here if you want: https://github.com/v8/v8 https://github.com/v8/v8
- tannhaeuser 8y agoI think it's useful to differentiate between JavaScript the classic language for adding limited interactive behaviours to otherwise static Web pages and JavaScript the language for full-blown MVw web apps and JavaScript the ubiquitous portable script language. For the first and third use case, really not much has changed since ES3/ES5: if you want portable JavaScript and appreciate simple "press reload button" workflows without babel or other complex transpilation steps, then ES6+ features don't add any essential capability, and I tend to avoid them. If OTOH you really need to develop SPAs with massive code bases and third-party libs, then ES6 and in particular ES7 with async/await is a big win. But I can't help wondering if the tension between these language profiles is going to work well for JavaScript in the long run. IMHO for full-blown apps there are much better alternative back-end languages available, and in any massive ES6 code base I've come across the desire to introduce types and type metadata is very much noticable (Angular and Typescript come to mind).
- gaius 8y agoThis is the argument that x86 must be a great ISA because look at all the tools people have written so that they don’t need to deal with it directly!
- partycoder 8y agoA programming language where almost everything is mutable is by design not good. JavaScript is popular because the learning curve is low and it was good enough for the web. Otherwise it is pretty mediocre even when just compared to scripting languages. Then, the "about" page of that blog is very concerning: "I am a world-class software developer". A world-class software developer would be people like John Carmack, Linus Torvalds or Dennis Ritchie.
- alephnan 8y ago> A programming language where almost everything is mutable is not good. That's a weird criticism. Object-oriented programmers are premised on mutation. As for JavaScript itself, mutations can be avoided. 'const' to prevent reassignment, using Object.freeze, or just applying functional programming principles and keeping functions pure.
- partycoder 8y ago1) Many languages won't allow you to redefine a type. 2) Mutate the prototype of a "frozen" object and you would indirectly affect it through its prototype chain... or mutate an nested property inside a "frozen" object. Most of JS standard library and most popular frameworks and libraries have fully mutable definitions. That sucks and is BAD design decision.
- alephnan 8y ago> Many languages won't allow you to redefine a type. This counterargument is not a good one. Just because other languages do things a certain way doesn't mean it's the right way in every situation. C++ has multiple inheritances and template metaprogramming, but that's C++. > Most of JS standard library and most popular frameworks and libraries have fully mutable definitions. That sucks and is BAD design decision. It's subjective whether this is a bad design decision. For the standard library, this enables polyfills. As for the popular libraries / frameworks, they have the option of freezing the prototype. They don't do this because they make the fair assumption that the client is not mutating the library state. It's the programmer's fault for breaking the interface contract and mutating the implementation. At any rate, this would be a criticism of the ecosystem, rather than language. If the criticism is about untrusted third party code, it's not an apples-to-apples comparison between JavaScript and other languages that are operating in different environments.
- maga 8y agoAs a long time JS dev I don't claim expertise in other languages, but every time I go back to check out new features in C++ or Java they feel more and more like JavaScript with types than "C with classes".
- paulhilbert 8y agoActually C++ these days is moving more towards strong typing and immutability - imho the exact opposite of JavaScript...
- egeozcan 8y agoI think JavaScript is moving in that direction too. There are some formal proposals for bringing types and community seems to like the individual attempts such as TS and Flow as well.
- johannes1234321 8y agoDue to auto and templates large parts of the strong typing can be moved to the compiler. When writing modern C++ one can be quite fast (not as fast as JavaScript) but get some verification, by the compiler, which fastens development time (i.e. typos in identifiers are located easily, whereas in JS you need to run the tests and then have to find the root cause)
- maga 8y agoThat's good to know. Introduction of iterators, lambdas, first-class functions, smart pointers, references, auto and in such in C++11 and Java left me with the feeling of C family languages converging on some similar set of features that resemble JavaScript more and more.
- simula67 8y ago> But here’s the thing: every language is weird I recommend that you read : https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallacy-of-gray https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallac...
- cm2187 8y agoTo me JavaScript is very similar to VBA. Based on its own merits it’s a pretty average language with lots of design flaws. But it has a monopoly for what it does (browser/cross platform vs ms office scripting) and most of its users never really got a chance to solve the same problems with a better language. And like VBA, it is probably the only language known to the bulk of it user base (semi-amateur web designers vs ms office business users). I care less about the performance benefits of web assembly than the fact that it will open browser/cross platform scripting to other languages and I’d be curious to find out if we are still talking about JavaScript in 10 years.
- daliusd 8y agoAtwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript. (2007) I personally find all programming languages limiting in one or another way and I use almost daily C#, Python and JS (sometimes I use other programming languages as well).
- alkonaut 8y ago> Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript. (2007) Funny you should mention it. Excel will now support JS scripting.
- Sharlin 8y agoThat’s appropriate: it is also the case that any application that can be written as an Excel spreadsheet will be (and has probably already been) written as an Excel spreadsheet.
- dijit 8y agoThat's life, some languages are better at different things; expecting any language to be all things to all problems is what eventually leaves you feeling like it's all hopeless I expect. bash is good, for chaining small utilities together. python is good, for single-threaded problems which don't hurt performance go is good, if you don't want to manage memory and need easy concurrency, strong typing/etc rust is good if you want to prevent having a footgun and low level access. C++ is good for giving you complete control over hardware. R is good for data science (although is being supplanted, many say, by python). Javascript doesn't have to be the "best" if it's not competing at all things, unfortunately, as Jobs famously said: "The future is web applications" and now javascript (which, if we remember is from a spec written by 5 guys in 2 weeks) has to fit all use-cases... it's a tall order for any language.
- onra87 8y agoThis is a lot of lines for not saying much. I was expecting much more from a "world-class software developer"(see About section) :) Saying that the community is more advanced in the JavaScript ecosystem than it is in the iOS world is a nonsense to me. Don't we have more JS developers than iOS developers ? Moreover, saying that JS syntax is really good with tools like TypeScript is another nonsense. You can also write Swift code and use another transpiler to get JavaScript code from it and you would say that JS is great. Last but not least, giving a state of the art of JS without event talking about tools like npm, babel or webpack is like scratching only the surface of the subject. I mean come on, JS is not only about == and === in 2018
- collyw 8y agoDoes "world-class software developer" even mean anything other than a big ego?
- onra87 8y agoI hope it's just ironic, so I give him the benefit of the doubt :)
- rusk 8y agoIt could mean that they see themselves as competing in a global marketplace. That they don't rely on geography and are quite happy to be ranked against the best of them. Not necessarily ranked highly but content to compete based on productivity and quality of work alone. Probably not what they meant though :)
- mjburgess 8y agoThe Leica selfie in the header says everything that needs to be said.
- bartread 8y agoI can't be absolutely sure what you mean by this comment, but it feels like a needlessly personal attack. FWIW, I don't really approve of the self-description of "world class software developer", either because (i) I'm not really sure what it means, but (ii) it sounds a bit pretentious. Still, it doesn't really relate to the quality or validity (or otherwise) of the post.
- wruza 8y agoSemantics and configurability is what what makes a language great. JS doesn’t have function environments, i.e. every unlexical lookup goes to global/window and that cannot be redirected. It doesn’t have green threads (at least). There are generators, but one cannot just yield without marking all the functions generators too (async/await in modern terms). Stack traces are lost when generators throw(). JS has no good introspection — you can do some Reflect, but cannot e.g. write a module that has a function, that when called enumerates all functions in a caller module and exports them by specific criteria. JS can’t properly substitute objects with proxies. It can catch simple existing key accesses, but can’t enumerate keys or arrays. There was handler.enumerate, but it was deprecated. Vue, which was written by no fools I think, cannot “app.array[3] = v” or “app.newkey = v”. It cannot dynamically watch an entire app too, all structure has to be defined before Vue(). Other problems exist, which are just stupid (null/undefined, in/of, ===, ;, this, etc) or minor design choices like coersion and lexical rules. But these above are stoppers for turning JS into something great. It is now a BASIC-level language with scoping and sugar. Yeah, you can write like that snippet presented in an article, but you are forever stuck with doing all things by hand, from asyncing to orm, from exporting to update scheduling. I don’t find that great in any way, especially when that is the only semantics you have in a browser.
- rusk 8y agoI think that much of these criticism relate to the implementation, and the runtime (i.e. browser) rather than the language itself. As a scripting language for a browser environment it's pretty good. Modern variants have lots of lovely language features and tools like babel mean you can use a lot of these new features without sacrificing backward compatibility. The threadless/nonblocking model is "interesting" but in my opinion its wholly suitable for user-oriented scripting as it forces a style of development that doesn't block. The null/undefined thing actually makes sense to me. The concept of "Null" is a swirling vortex of uncertainty in most languages and it's nice to see it get some more nuanced treatment. There's something about the bloody-minded pragmatism of javascript that appeals too ... it's very much a language that has evolved from the bottom up based on need, and much of it is very much community driven. You see problems solved in interesting and unusual ways that you mightn't see in a more stringently stewarded language. I wouldn't use it for everything. I wouldn't prescribe it for beginners to programming either. But it's great for what it does. I like lots of other languages too, but I respect their applicable limitations. It's a nice language.
- icc97 8y agoPersonally what I love about JavaScript is that it brought the basics of functional programming to the masses. Obviously it's far from pure FP, but I think it's much more at the heart of JS than it is say Python. The Scheme parts of JS are the good parts. I think some of the resurgence of FP is down to JS. The wealth of libraries available is pretty impressive [0] [0]: https://github.com/stoeffel/awesome-fp-js https://github.com/stoeffel/awesome-fp-js
- DavidBachmann 8y agoI got interested in functional programming through JavaScript. It might have been React w/Redux that initially demonstrated the value of immutability and pure functions to me. One day I got curious about monads and spent over a month trying to wrap my head around it, which obviously set me on the path to Haskell which is now my favorite thing in the world.
- JepZ 8y agoSeeing JS as a functional programming language is actually the way of learning how to use it properly.
- bytematic 8y agoJavascript is fine for projects of small to medium size, as is any scripting language.
- ajeet_dhaliwal 8y agoMy developer friends do have opinions on JavaScript that are in my view outdated, modern JavaScript is my favorite peogramming language due to the ease of expressivenesss and joy to write it. I started out with C, C++, Java, Objective-C and C# before ever seriously using JavaScript (other than tiny snippets of front end browser dom manipulation) and may be I’m just getting old but... I’d love to use JavaScript for everything if I could.
- atomicnumber1 8y agoI find swift and python to be more elegant in terms of expressiveness. Only issue with swift is that it's ABI isn't stable yet and still not official support for windows (I think, will need to check this).
- ajeet_dhaliwal 8y agoMy eyes see the curly brackets easier than indents for scope probably because of my background and I forget the colons sometimes but yeah Python is a usually a pleasure too
- WorldMaker 8y agoAt this point the only thing I feel like I'm left missing from Python in semicolon-free ES2015+/Typescript are list/generator-comprehension syntax [0] and slice notation [1]. [0] The Pipeline Operator Stage 1 proposal is currently the closest proposal to making something like that happen: https://github.com/tc39/proposal-pipeline-operator https://github.com/tc39/proposal-pipeline-operator [1] Stage 1 Proposal: https://github.com/gsathya/proposal-slice-notation/ https://github.com/gsathya/proposal-slice-notation/
- zaarn 8y agoThe syntax example didn't look any different to what I'd see in modern Java, C#, Go, Rust, LISP, etc. The syntax can make or break the language for some (Rust for me) but in the end, if you sit down and look at it, most languages in use today will be similarly easy to read (except Haskell). It's not better that the example isn't even JS itself but rather the only JS dialect I don't refuse to work with since it has a type system that is more solid than wet tissue paper. As the author themself admit, syntax is not important, so why bring it up? That genuinely seems like a way to A) bring up the argument and B) in case anyone refutes the argument being able to simply say "well it didn't matter anyway". --- Toolchains are another bad point. VSCode doesn't only exist for JS, it has support for other languages as well and I very rarely make use of it as JS IDE. If I need a third-party toolchain to fix up the most basic mistakes of the language's design I don't think the language under that mess will be terribly good. Other languages don't require an entire toolchain to provide a minimum of coding safety. People agree that writing in C is something hard and dangerous, it also needs an entire toolchain to achieve a minimum of "not segfaulting on startup". I should be able to simply take the first party language tools and use those to get to a point where my application starts and the correctness of my code not being coerced to false. --- While it is indeed commendable that JS has such a big community, I think the community still has lessons to learn. The churn in the ecosystem is beyond fantastical levels, not in a good way. When I pull in sqlite3 for my project I can be reasonably sure that this project will be maintained for the next 20 decades and I will be able to use sqlite3 in 20 decades without much problem. With JS dependencies I will always ask myself subconsciously if they're going to be maintained next week. I don't write software that runs for next week, software I write is intended to function for the next 20 decades. Of course it'll get patched and maintained but I don't want to switch out my underlying framework because Google decided that their JS code has become too boring after 4 months of work. The GraphQL examples is just an example of this. The tech is barely 5 years old, the tooling in all languages other than JS was extremely immature last I checked. Why should I bet on something like that to work and be maintained in 20 years? --- I'm getting a bit rant-y but I'll take this last paragraph to disagree with the conclusion too. Most languages have some bad design. Usually that is fixed in the language or by first party tooling. That's not my problem with JS. My problem with JS is that the moment I write JS I have to involve myself with the community of JS, a community that has laughed (!) and scoffed (!) at me for suggesting that I want to maintain software for a long time beyond $CURRENT_YEAR. The ecosystem and community of JS are rotten and flawed, that's why I don't use JS where I possibly can and if I do it's vanilla browser JS pushed through the minimum installation of typescript I can get away with.
- dpwm 8y agoI'm an outsider to the JS world but find it absolutely fascinating the direction the language has taken. It's clear that a lot of the new language features enable more concise functional programming. I see this as a good thing. I'm really surprised that whilst the language on the one hand gives nice tools like the object spread syntax, the last time I checked it didn't make it easy to make the interpreter enforce immutability. It seems strange to me that the language evolves in this way to recognise foot-guns but doesn't give you the tools to turn them off. Object.freeze looked like it would do the trick, but it's shallow. Freezing doesn't survive the spread syntax, which makes perfect sense because it freezes the original object, and of course the whole point of immutable objects is to create a new object. It feels like you're able to program in this style, but the language designers didn't really consider it very much and were just introducing the syntax to be consistent with the other spread syntax.
- sibeliuss 8y agoAgain, tooling: https://github.com/jhusain/eslint-plugin-immutable https://github.com/jhusain/eslint-plugin-immutable
- interdrift 8y agoAlmost puked a little in my mouth
- vinayms 8y agoI am primarily a C++ dev and had to use JS for web development. Having no previous scripting experience, I was gobsmacked at the ease and freedom it offered, especially wrt string processing. You need to have been a monolingual C++ dev to appreciate what I said. I don't hesitate to say I like JS. These days I try creating any small experimental programs I need in JS and run them in FF instead of starting the whole build process with C++ code. If there is file i/o needed, I use an extention that I have created for this purpose. When necessary, converting this prototype into C++ code is not a big deal. As for its flaws, well, which language doesn't have flaws. Part of being an experienced dev is to learn, respect and avoid the shortcomings of the technology you use, aka paying attention. Its arguable that some flaws in some systems are worse than some flaws in other systems since the design factor comes into play, but with something as pervasive and monopolistic as JS, there is a clear choice to be made - create something better for the community or shut up and live with it. I am sort of doing both. (To pull off the first one, I need some serious credeitials, which I hopefully earn in the near future.)
- eludwig 8y ago>>I was gobsmacked at the ease and freedom it offered Totally agreed. Same coming from Java. It is crazy how much I prefer it over Java. Maybe this is a consequence of coming from verbose languages? The lack of boilerplate is very refreshing!
- spdionis 8y agoWhy not use node so you can avoid the browser and the extension?
- megaman22 8y agoNo, it is bad. It is a pox on software development that we've had to fight for two decades just to get back to where we were. Everytime I see new innovative thing that is a retread of 1980s unix development, I die a little inside.
- tzahola 8y agoWhat a condescending, entitled twat.
- fefe23 8y agoI think we have a case of Stockholm Syndrome here. He claims on one hand that Javascript is great and then cites the awesome tooling like Typescript. Well, a great language would not need Typescript, now would it? I think the most obviously damning thing about Javascript is how the rest of the world bends over backwards and speaks JSON now because it's less trouble if we adapt to JS than if we adapt JS. Well, yeah, if you change the problem to fit your programming language better, then your programming language will feel convenient and like it always fits well. Duh.
- adjkant 8y agoI don't think JSON is a signifier of that - we had XML before and you're always going to need plain text types of files like that. Python also plays well with JSON. It's just Java/C++ types that don't play easily with JSON unless you want a lot of translation and processing. That said, I agree with the rest of the points. I do love JSON though.
- tannhaeuser 8y agoIt just struck me that TFA is published exactly ten years after Douglas Crockford's "JavaScript - The Good Parts".
- holstvoogd 8y agoTL;DR: JS is great if you like it and know it well! I'd say that holds for pretty much any language. The blog starts with an example to show how clear and concise etc the syntax is. I, personally, find the syntax unclear, verbose and I have no clue what that code does at a glance. But I guess that is actually the crux of it: if you enjoy Js and are productive with it, great! Just don't ask me to work on your code, I'd make a mess :)
- Blackstone4 8y agoJavaScript has continuously evolved and probably at a faster pace than many other languages. I'd interested to see whether those who used ES5 and didn't have a good experience, would enjoy using ES7 with async/await. The JavaScript ecosystem is large and this question can be broken down into: - Is JavaScript good on the browser for the front-end work? - Is JavaScript good on the server? Also for those interested, I create a Poll HN: favorite web server language and front-end submission over here: https://news.ycombinator.com/item?id=17081114 https://news.ycombinator.com/item?id=17081114
- blauditore 8y agoThe fact that the author omits semicolons in JS somehow fits the theme of this post...
- cesarb 8y agoThere is a school of thought that semicolons in JavaScript should be omitted except where they can't: https://github.com/standard/standard/blob/master/RULES.md#semicolons https://github.com/standard/standard/blob/master/RULES.md#se...
- blauditore 8y agoI'm well aware of "Standard"JS, and it's highly controversial to put it mildly. The fact it was named "standard" is quite infuriating, as it's just a bunch of random people churning out an arbitrary set of formatting rules. This is not how standards are acquired. Now, many devs unfamiliar with JS use it because they google "javascript standard formatting" and obviously find this.
- martin_drapeau 8y agoI forgive Javascript any "language flaws" it might have. Why? Because the truly beautiful thing about Javascript is that you can write a program, send anyone a URL and they can run it. No compilation, no installation - just open the URL in any browser. No other language in the world can do this in such a universal way. Simplicity is bliss.
- dsego 8y agoYeah, because people usually compile their programs before running them.
- kbp 8y ago> Yeah, because people usually compile their programs before running them. The developers do, yes; with Javascript, they don't have to worry about compiling for multiple platforms like, say, a C developer would, they could even just ssh into a server and edit a single text file while everybody across Windows/Linux/MacOS/iOS/Android/etc can run the new version as soon as you save the file (mod browser compatibility issues, of course). I think their point was that Javascript is the only language that can do end-to-end simplicity like that.
- Grue3 8y agoWhen someone makes a statement like this, it raises the question: compared to what? What other languages does the author have experience in to proclaim that Javascript is good? Also I never seen anyone complain about Electron apps because of the language they're written in. The main complaint is that it's a tremendous waste of computer resources. If your chat app needs more than 1gb of RAM, I don't care what language it's written it, it sucks period.
- peterbraden 8y agoOh man, I hate these articles as they bring out the trolls. Javascript is a great language because it allows you to develop incredibly fast (scripting language) for a platform that runs everywhere (the web). It used to be far simpler, but IMHO, insecurity because of all of the FUD that this sort of article prescribes, has meant that the language has bloated to incorporate all sorts of syntax improvements and new patterns. It's not a systems programming language, so all the comparisons against typed, compiled languages are moot. Introducing transpiling as a mandatory pattern for JS development was a mistake. The reason JS has won is because the web has won. Arguing about its merits misses the point.
- pjmlp 8y agoMy mobile devices and ChromeOS adoption of Linux and Android native apps prove otherwise.
- macspoofing 8y ago>It's not a systems programming language, so all the comparisons against typed, compiled languages are moot. No they are not 'moot'. At least not if you're building applications with 100k+ LOC. For dinky websites and small projects I'm with you. >Introducing transpiling as a mandatory pattern for JS development was a mistake. Again, what are you building? A dinky website, or a large application that you'll have to maintain for the next 10 years?
- peterbraden 8y agoTranspilation is the number one reason I've seen that makes maintenance of older projects hard. The fact that JS didn't standardize on a module syntax until far too late means that we're forced into a transpilation cycle to build bigger projects. I can call that a mistake without denying it's reality. If you want to build a web application, at some point, until we have true web assembly, you will have to use javascript, which does make a lot of the arguments here moot, regardless of the size of the project.
- macspoofing 8y ago
- dandare 8y ago> equality in JavaScript is a bit bizarre That flux capacitor diagram is super interesting but I think it is missing a point. The bizarre equality happens due to truthy and falsy evaluation, which is a very practical concept that saves you a lot of time when you actually want to get shit done.
- skywhopper 8y agoI never felt the author got around to describing what makes Javascript good. I mean, hey, it's indisputable that lots of people love it, and it's fine to write up an article defending its quirks. But the existence of good tools, an OSS community, and reasons for the quirks don't sum up to a reason to try Javascript. I was hoping for some more insight into the language itself, but that was never touched on.
- marsrover 8y ago> I’m not going into more detail because syntax is… well it’s not that important to a language. Syntax is (I’m waving my hand dismissively here) just syntax Tell that to Brainfuck. Sure, JavaScript is a great language if you ignore all the shitty parts.
- EtienneK 8y agoJavaScript is Good, but TypeScript is better.
- gaytards 8y agojavascript is bloated shit language that betas drool all over. The language and apis are hacked together shit code that cant do shit half the time. You cant preform intensive tasks with that shit script.
- luord 8y agoI agree with the general idea and I like js... But don't like electron or jsx because they're wasteful and too much of a mix of stuff, respectively.
- eptcyka 8y ago> JavaScript is good, actually. If you use Flow and Typescript which are not Javascript. That's like saying that Java is good, actually, if you use Kotlin. But not really, because the UX of using Kotlin is 100x nicer than using transpilers.
- adjkant 8y agoI see a lot of people that are pro-JS are coming from Java/C++: Re the Javascript advantages of JSON and quick writing: Python! It too has its flaws, but so many fewer and writing in it is a breeze. Python 3 is only getting better to, so if you do start, take the time to start in 3, not 2. Javascript is indeed pushing more function programming type stuff, but if you really want that, go with a Lisp/Scheme or Haskell IMO. It's simply what I've been exposed to, but Racket is a great language for quick little programs. You can also go functional in Python easily enough as well.
- AndrewSChapman 8y agoI also wouldn't call JavaScript great. It's adequate and tolerable. Typescript makes it better. Languages I'd call great include: Kotlin, C# and D.
- xntrk 8y agoI would have liked to have seen some comparisons. Showing javascript syntax but then not showing anything else and then saying its good is not really an argument. And aren't frontend dev essentially forced to use javascript since we can't compile to anything else at the current time? yes webasm is coming and yes there are languages that compile to js
- kuon 8y agoI have been working with elm for 2 years now and shipped 4 projects. I can say a lot of good thing about elm, but the most important one, and something that outweight a lot of thing is maintainability. Each time I had to change something in a shipped app it was painless, stressless (I know I won't add regression) and fast. I won't say JS is bad, but the absence of a compiler makes it much more fragile, especially when working on old code.
- bgorman 8y agoAlmost everyone writing JavaScript these days uses a compiler like Babel, webpack, browserfy etc..
- deleted 8y ago[deleted]
- alangpierce 8y agoI think by "compiler", they really mean "typechecker", which is much more important for maintainability than code transformations. JavaScript does has two good typecheckers, TypeScript and Flow.
- kuon 8y agoI worked with typescript for a project, but the compiler don't help a lot compared to the elm compiler.
- qaq 8y agoJS is ok, TypeScript is pretty good. Still I would rather use say Elixir for a large project on the backend, but for a small project node is not a bad option.
- hn0 8y agoForced OOP model [1], lack of types, highly redundant syntax (ES6 whyyyy). After years I’m still fighting with the language, not to mention the browser with it’s frankensteinian api. Browsers should have just created a Lua dialect, which is like a more sane version of JS, and throw JS back into the nineties-fads hellscape that spawned it. Perhaps in an alternate dimension Eich will have done a non experimental port of Scheme or would just have done WASM from the start. I’m pretty sure at least there every PC would just boot into Netscape by now. It’s true that the infrastructure around JS has gotten a lot better, but that’s despite the language. If anything I should thank it for popularizing FP which will hopefully eventually slay the chimera that is OOP. [1] Or, more specifically, “POOP” to emphasise its prototypical nature.
- sgentle 8y agoI don't think anyone benefits from watering down the definition of "good" to the point where it describes Javascript. Javascript – sorry, modern Javascript – sorry, surfing a compile-to-JS liferaft atop a thick and constantly shifting foam of tooling and libraries disgorged by literal person-millennia of community effort – can be surprisingly decent if you're careful. Any meaningful definition of good has to draw a line between things that are and things that aren't. The definition here is broad enough to include basically any language that is popular. C++ is also good because it has a good syntax for the things people use C++ for, a big community that builds tools for it, and it has quirks but come on every language has quirks. "Just because you disagree with the decisions doesn't make the language bad" is a funny way of describing absolute bald-faced mistakes like typeof null == 'object', the baggage of 20 years of browser quirks (JS tristate logic: true, false, and document.all), and "no that was totally intentional minimalism" oversights like the lack of coherent collections and iteration primitives. When I think about good, I think about Rust's memory model, Erlang/OTP's supervisor trees, Java's standard library, Clojure's immutable data structures, Python's syntax, .NET's LINQ, Haskell's type system, Idris's type system, Go's mascot, or Elm's delightful mix of programming language and solo performance art piece. Despite the author's attempt to head this criticism off, the reason we use Javascript really is just because it's in the web browsers. Web developers had to use it, so we made the best of it. We wrote libraries and tools to make it bearable, we built new languages on top of it so we didn't have to deal with its bullshit, and once Ballmer quit ruining the internet we built those improvements back into the language itself. But is that good? Layers upon layers of accreted improvements, each with more legacy carve-outs than the last? "We can never throw away a bad idea" is a one-way complexity ratchet that precludes unqualified goodness unless there were no bad ideas to begin with. With Javascript, that is not the case. The best it will ever achieve is that it has good parts. If INTERCAL was the de facto language of the web, we'd be writing Medium posts about the benefits of Automatic PLEASE Insertion and how excited we are for ASYNC COME FROM to land in INTERCAL2018. And, hey, it's not perfect, but it gets the job done, there's a good community, and at least it's not Objective Malbolge. Who are we to criticise?
- LandR 8y ago> Elm's delightful mix of programming language and solo performance art piece. Brilliant.
- edem 8y agoThis is very relative. If you compare it to Cobol, then yeah, it is good! If you compare it to Kotlin or Clojure? Not so much. See, everything depends on your viewpoint and your viewpoint depends on what you know. If you only know javascript than it may be good.
- api 8y agoJavaScript is IMHO not a bad dynamic language, especially for rapid development of typical web, UI, glue, and scripting stuff... in other words most of what you use dynamic languages for. We are moving to Go for our backend because dynamic languages don't scale with complexity or team size, but that's another matter.
- snarfy 8y agoWhat's old is new again. Electron feels very much like the old gui systems like ToolBook, VB6, and other 'RAD' tools. It's not so much about the language as all the 'batteries included' toys that come with it.
- proginthebox 8y agoexcept that the old gui system ran on 650Mhz processors and 256MB RAM.
- ianamartin 8y agoThis article’s reasoning seems really confused to me. He seems to be saying, “Hey, this ting that everyone calls a shit sandwich isn’t really a shit sandwich. Let me tell you why. I go to this nice restaurant and eat things that are not shit sandwiches. And they are fantastic. But they all end up as shit eventually, so it does t matter. Therefore JavaScript is not a shit sandwich.”
- yedava 8y agoCode spends most of its time being in production and not in development. During that time in production, developers will leave the team, bugs will show up, major enhancements will be made. So it is important that the codebase is easy to reason about, easy to refactor and easy to debug. If you take a language like Java and an IDE like Eclipse or Intellij IDEA, it is trivial to find from where a particular piece of code is called from. Whereas in JavaScript, particularly in huge codebases, you can't easily tell how a piece of code ends up getting called. You will need to run the code, make some educated guesses and put breakpoints or console.log statements to verify that yes, this particular line does end up getting called on this particular action. Refactoring is also a joy in a language like Java. You can easily modify a method signature and the IDE will take care of updating all the places this method is called from. Now imagine you add a new argument to your JavaScript function and want to update all the places where the function is called from. So judging JavaScript on these factors, it isn't such a good language.
- mistercow 8y agoYou can always cherrypick advantages and disadvantages to make a language look "bad", or make another language look "better".
- gameswithgo 8y agowhat can you cherry pick from javascript to make it look good?
- hajile 8y agoComparing with Java or popular languages like those at the top of tiobe? Lambdas, First class functions, and closures are a great feature missing in basically every other popular language (things like Javas lambdas or function pointers aren't even close in real world use). Proper tail calls is another feature missing from that list and despite some browsers refusing to honor the spec they ratified, it's still implemented in Safari/javascriptCore, XS6, duktape, node 6-7, etc. The interplay between js dynamic objects and closures is difficult to describe, but a thing of beauty when fully understood. Object literals are also basically unique to js on that list as well. There's a lot to love about most languages and JS is no exception.
- quantumofmalice 8y agoJavascript is the Chauncey Gardiner of programming languages. It was there.
- deleted 8y ago[deleted]
- btbuildem 8y agoThe great thing about JS is how accessible it is. A child can start tinkering with it and build stuff. The problem is, the children did do it, skipped going to school to learn the basics, and now we see clearly reflected in the evolution of the ecosystem their efforts to slowly re-discover and re-invent everything.
- kapv89 8y agoFor me, as a founder of a young startup, the overarching benefit of being proficient in modern JS and sorrounding tooling is that I can use the same language for my whole stack(servers, web, Android, iOS), and spend more time thinking about the product and business. In the possible future where the company grows enough where it needs a distributed server software, the only part of the product that'd be changing would be the backend, and I'd probably look at Java for that. For the rest, React(& react-native) + graphql + a typesystem is a pretty good stack for UI software.