Good JavaScript usage is a good thing

January 14, 2013

A commentator on yesterday's entry wrote the standard sort of anti-JavaScript note. Quoted in part:

[...] 99.9% of websites do not need scripting. (Perhaps 100% -- google maps should be a standalone program.) I am convinced JS is a make-work phenomenon by a large amount of underemployed web-monkeys, desperate to create "work" that is not needed. [...]

I disagree strongly. Despite my grumbles yesterday and despite my use of NoScript to mostly block JavaScript in my own browser, I am all for well-done JavaScript usage. There are two things that JavaScript is really good for.

The first and most obvious is enabling interactive web applications that would not be possible otherwise. Google Maps is a good example, as are a number of other highly interactive and responsive websites (some of them operated by Google). The second is for augmenting already functional websites with additional useful interactivity, a topic I have some experience with. There are any number of websites that do this (if you browse with JavaScript on you probably don't even notice this).

It is no accident that I've emphasized interactivity in both cases. The problem that JavaScript fixes is that without it your only real way of interacting with a web page and a web server is by clicking on things and generally getting a new web pages. Clicking on things is a fine way of getting stuff done, but the problem is that it is obtrusive, limited, and explicit. There is a universe of other ways of interacting with an application (eg clicking and dragging) and another universe of automatic actions that an application might want to take without requiring the user to explicitly invoke things with a click.

What's bad about JavaScript is threefold. First, people have used it to do evil things. Second, people have used it to create terrible, obnoxious interfaces. And third, what I ranted about yesterday, people have used it to destroy otherwise functional websites. But none of these are intrinsic in JavaScript itself. JavaScript is a tool that can be used well or used badly.

Sidebar: Why I disagree that Google Maps should be a program

I will put it simply: if Google Maps was a program, it's likely that I would not be able to use it and it's even more likely that people using FreeBSD would not be able to use it. The advantage of JavaScript applications is that they are more or less portable more or less for free.

(This is not just portability between operating systems. It is also portability between Debian, Fedora, Ubuntu, SUSE, and so on, and between old distribution releases and new ones.)


Comments on this page:

From 69.165.207.59 at 2013-01-14 06:59:46:

There is something fundamentally wrong, IMHO, with letting documents (or other people, malicious or otherwise) tell your computer what to do. (And with essentially no code review!) I totally agree that browsers/webpages should be more interactive, but this should be user-driven, perhaps via new "interactive" html tags. A severely minimized version of JavaScript, purely for interactivity, might be a good solution. But a full blown programming environment, and trying to put everything-in-a-browser, is absurd.

Why wouldn't you use a standalone Google Maps program? You don't think a gtk would do a far better and more responsive job?

By cks at 2013-01-14 08:22:19:

Why wouldn't you use a standalone Google Maps program? You don't think a gtk would do a far better and more responsive job?

I think that the odds of Google developing Google Maps for Linux as well as the majority platforms are moderate and the odds of them developing (and building) Google Maps for FreeBSD are even lower. From one perspective the great advantage of JavaScript is that the porting work for applications is done by the platform developer, not by the application developer. There are many fewer platform developers than app developers and they have a much bigger motivation for having apps on their new (and generally unpopular) platform.

A severely minimized version of JavaScript, purely for interactivity, might be a good solution. But a full blown programming environment, and trying to put everything-in-a-browser, is absurd.

How would you minimize JavaScript? Once you have a Turing-complete programming language that can manipulate page elements to make them interactive in ways that go beyond the inadequate specific options that browser vendors provide in HTML, you have something that is essentially JavaScript today. The elements that are essential for making web pages usefully more interactive are the same elements that you can build a full app out of.

(And you can't take out AJAX; AJAX is a core element of better interactivity.)

I don't believe that browser vendors can design all of the interactivity that's desired into HTML elements for a collection of reasons that include that browser vendors more or less necessarily move too slowly.

Written on 14 January 2013.
« Blogspot's massive web 1.0 failure
Why JavaScript (or something like it) is in demand »

Page tools: View Source, View Normal.
Search:
Login: Password:

Last modified: Mon Jan 14 01:33:42 2013
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.