Popularity Of Java Script

Is JavaScript common because many developers like it, or because it's the built-in language of web browsers, avoiding the need for client-side pluggins. Such browser entrenchment could be seen as a form of QwertySyndrome.


Discussion moved from GreatLispWar:

As far as your UI statements, that's only true because we are stuck with JavaScript in a QwertySyndrome kind of way, NOT because people love JavaScript. True, we sometimes have to learn ugly tools/techniques because of problem standards. I'll give you that one. But, it may not last long because people are hungry for a better client GUI standard than the HtmlStack and would run with joy from it if there was a viable alternative that was more like say Delphi. -t

[We aren't stuck with JavaScript at all. GoogleWebToolkit has been around forever, then there's newer stuff like Dart, CoffeeScript (and friends, like Coco and LiveScript), TypeScript?, and Roy, to name just a few of the most popular. Yet JavaScript, and alternate languages that preserve its semantics (the CoffeeScript family in particular), are still exceedingly popular both in-browser and elsewhere thanks to Node. It's unlikely that we'll be replacing the HtmlStack with some new standard any time soon, but we don't need to; HTML, especially considering all the HTML5 additions, is absolutely expressive enough, and going forward we're almost certainly going to keep extending the HtmlStack standards rather then throw them out in favour of a totally new standard. -DavidMcLean?] {Off-topic: I'd love to see AmberSelf? in the spirit of AmberSmalltalk}

My sense of the industry is that a good many people don't like JS for SystemsSoftware or SystemsSoftware-like uses, such as GUI kits. If that differs from your experience, we'll just have to call it an AnecdoteImpasse and LetTheReaderDecide.

[Well, one of the primary use cases for JavaScript is manipulating the DOM to build more complicated UI widgets, and considering the huge proliferation of jQuery plugins (among other things) it seems to be rather competent at this. There's also things like Angular, Knockout.js, and Ember.js which all build powerful (and very popular) GUI kits on a JS base. In addition, JavaScript is used to build a lot of compilers; it's especially popular for that purpose because you can then easily make "try" pages for your language, like http://learnboost.github.io/stylus/try.html http://jade-lang.com/ http://js2coffee.org/ . I believe you'd also consider http://gruntjs.com/ something that falls under SystemsSoftware, and it's ridiculously popular. You may be unfamiliar with many recent JavaScript projects, but the forefront of Web design makes heavy use of these things. -DavidMcLean?]

A large part of this is that because of client-locked QwertySyndrome, people are forcing JS to be a systems language, and embracing the wrong tool for the job because they have no other real choice.

[But it's not client-locked. As noted, there're a wide assortment of options on the client, including Dart and GoogleWebToolkit which both completely avoid JavaScript. And Grunt, along with the various compilers, is run primarily outside the browser, where there is complete freedom in language choice. -DavidMcLean?]

If you write a new SystemsSoftware-friendly language interpreter/compiler in JS, then technically you may be right, but it's kind of an AbstractionInversion. Most would agree that's not the ideal. It's an ugly solution to an ugly problem. It's like writing a C compiler in Perl when instead you should be writing Perl in C.

[Dart is pretty much a new SystemsSoftware-friendly language that compiles to JS, so yes, that's happened; that wasn't my point anyway, though. My point is that, although there are a wide range of language choices available both in the browser and out, JavaScript itself is still used for widely-used examples of systems software such as Grunt. Surely this is indicative of the language having some actual appeal? If there are no redeeming qualities to JavaScript beyond it being the locked-in choice, why use it for Grunt, or for Jade? Why not use Dart or GWT to build Ember.js, if JS is allegedly so bad at that kind of thing? -DavidMcLean?]

Some? I'm not sure what your point is here in relation to prior statements. It appears to generally repeat prior points. Perhaps we should start a new topic such as JavaScriptPopularity? or the like since we are wondering off topic. However, it will likely be filled with mostly anecdotal info, and our observations and "feeling" for the industry is apparently different. Anecdote-fights are not fun and not welcomed by most WikiZens. Again, I don't sense any general love for JavaScript for systems-software-like uses and any apparent popularity appears to be a direct and indirect result of a form of QwertySyndrome due to its inclusion in web browsers. I suspect if BrainFsck was the imbedded language of browsers, people would be making Grunt interpreters out of BrainFsck. Since God denied my grant to fork Earth, we cannot test that theory. (As a "glue" language for relatively light-duty scripting, most are "okay" with JS there.)

[When would JS have been subject to QwertySyndrome, in terms of that causing its adoption outside the client environment? The client hasn't been locked in since 2006, when GoogleWebToolkit was released - it's older than jQuery, in fact, and hails from the halcyon age of JavaScriptSucksInBrowsers, when on the whole nobody was using JS except for one-off client hacks. JavaScript's recent popularity is just that, recent. If it were caused by the old property of client lock-in, it would've happened a lot sooner. It's far more likely that JS's popularity correlates significantly with Douglas Crockford's book, JavaScriptTheGoodParts?, published in 2008; it's only after that book's release that JS has become popular for servers and other applications (NodeJs, CoffeeScript, and Angular in 2009; Knockout in 2010; Ember in 2011; Grunt in 2012). -DavidMcLean?]

Are you suggesting users should expect to install special browsers or browser add-ons to have client-side code in a particular language other than JS?

[Absolutely not. That may be what AdobeFlash?, MicrosoftSilverlight, and Java applets expected of users, but I don't. GoogleWebToolkit, CoffeeScript, Dart, and so on can all run in-browser without any special extension. -DavidMcLean?]

Then you have the slowness of an AbstractionInversion, including downloading an entire interpreter for each page/site, which is stupid.

[No, you assume that you have the slowness of an AbstractionInversion, including downloading an entire interpreter for each page/site. None of that is necessary. GWT, Dart, and CoffeeScript are compiled. -DavidMcLean?]

How is that different from Java applets?

[Java applets require the Java browser plugin to run. Apps written in GWT/Dart/CoffeeScript don't require any plugins, nor any other extension to the client's browser. -DavidMcLean?]

Most browsers shipped with Java, for a while. But at least the Java pluggin was designed to run Java byte-code, unlike JS, which means the approach you suggest is going to be slow. It's often why JS GUI's are so jittery and unresponsive and jam pages.

[Whether browsers shipped with Java in the past is immaterial. It's still a plugin that users might not have. In terms of performance, first note that for the most part client-side apps are IO-bound rather than CPU-bound, which for NodeJsAndHofDiscussion reasons means that a small performance overhead in the client is negligible. Next, note that all the languages I mentioned are compiled to JavaScript well before they're delivered to the client; compilation can be slow, but all the client actually deals with is clean, well-optimised JS. Which brings me to my final point: JavaScript isn't slow, at least not any more. The JS engines used in both WebKit? and Gecko have phenomenal JustInTimeCompilation, and given a little JavaScriptTheGoodParts?-style discipline it's easily the fastest interpreted language out there. If you're convinced that JavaScript GUIs are on the whole jittery and unresponsive, would you care to provide examples of this? My experience, especially with Google applications, suggests otherwise. -DavidMcLean?]

Either way, you are arguing that JS can be treated like a machine language with another compiled language "running" on top of it. But that's not selling JS for JS's abilities in terms of its language features, which was the original reason JS came up. (Any TuringComplete language can be used to execute other language's machine code or p-code.) -t

[My point was that, while JS can be viewed as the assembly language of the Web and alternate languages used (GWT, Dart) in its place for actual development, for the most part it isn't. You got sidetracked by the means whereby these compile-to-JS languages work; the important thing to consider here is that, although GWT or Dart could have been used to develop Angular, Knockout, and Ember, they weren't; JavaScript was still chosen despite the ever-present availability of choice, which surely indicates that JavaScript's features have merit. -DavidMcLean?]

How do we know that browser entrenchment didn't play a large role in such decisions?

As far as general "love" of JS, the "community commentators" at SlashDot don't seem to show a general love of JS. There are far more "haters" than "lovers" there, as I informally survey the comments:

http://developers.slashdot.org/story/14/02/01/1618226/the-javascript-juggernaut-rolls-on

In general, for non-trivial browser-side GUI programming, most seem to want a stronger TypeSystem and better name-space management.

[Those wanting "better name-space management" are uninformed. Any non-trivial browser-side GUI programming will make use of the CommonJS or AMD module specifications, through http://browserify.org/ or http://requirejs.org/ respectively, and both module systems are extremely expressive in terms of namespacing. (Adding a stronger type system is a suggestion that has merit and is one of the major motivations behind GWT, Dart, and TypeScript?. Barring a few quirks, however, such as the [3, 10, 5].sort() example presented in the aforementioned comments section, the JavaScript type system really is no worse than any other dynamically-typed language's -- and on the flipside, I can confirm the stronger static type system offered by TypeScript? makes a lot of common patterns really inconvenient!) -DavidMcLean?]

Many either don't want a dynamic language for heavy GUI usage, or want something that at least "encourages" explicit types, such as requiring typed parameters. ("Variant" or "object" may still be allowed, but not easier to code than an explicit type.)

[My experience is that TypeScript? in particular is awful for heavy GUI usage (specifically, for a Knockout-based application -- it's a custom business app, so I'll provide specific examples if desired). But of course experiences differ, and it's entirely possible other statically-typed languages do a much better job. -DavidMcLean?]

Why is it awful at GUI's? Perhaps the DOM itself is the problem?

[No, all my problems were specifically with TypeScript?. I've started writing up TypeScriptInconveniences to illustrate a few. -DavidMcLean?]


FebruaryFourteen


EditText of this page (last edited March 1, 2014) or FindPage with title or text search