VBScript is to VB as Cheese is to…?

A Joel On Software reader made the mistake of stating in my presence:

"VB is to VBScript as Java is to JavaScript."

Though I can see some truth in that, I'd classify that as a poor analogy.

Why?  Because VBScript was designed to be a simple subset of the VB language. One of our major design criteria was that a VBScript program be a legal VB program. There are some exceptions, but more or less that's the case.

JavaScript is not a subset of Java at all. It's an entirely different language with a superficially similar syntax -- just as C, C++, C# (and for that matter, perl and AWK!) have superficially similar syntaxes.  Just because you can write z = x << y + a & b; in a bunch of different languages doesn't mean they have anything else in common. Remember, JavaScript was originally called LiveScript, and Netscape changed the name because (among other reasons) they believed that they could capitalize on the incredible hype surrounding Java. Unfortunately, they managed to create a lot of confusion as well.

Compare JavaScript and Java at a high level, not a syntax level, and you'll see that the type system, exception system, class system, libraries, compilation model are all quite different. Pretty much everything about Java and JavaScript that makes them interesting as languages languages are different!  JavaScript is certainly more similar to Java than, say, Prolog, or Befunge, or Urdu, or the colour blue, but that analogy really doesn't hold up well.

Finally, as my friend Jon once remarked "American cheese is to good cheese as this analogy is to, uh, something."  I puzzled over that one for some time trying to determine if it is an apt analogy or not.  Like American cheese, it's a paradox.

Comments (12)

  1. Darrell says:

    You mean it’s not as simple as they both add a "Script" suffix to the original language name??? 😛

  2. Daniel Auger says:

    Powedered cheese packets (ala mac’n’cheese)?

  3. Dan Auger says:

    Powdered… I’m useless w/o spell check.

  4. Robert Sayre says:

    Although I hesitate to defend Netscape’s choice of name, I heard they changed the name to JavaScript because they thought people were going to use it primarily to control Java Applets, rather than manipulating markup.

    I’ve also heard that VBScript was originally intended to control COM objects that "real programmers" would write to do the heavy lifting, and that MS was caught off-guard when people started building whole sites with it.

  5. Eric Lippert says:

    Well, sure, there are always multiple reasons behind any choice of name. I have _suspicions_ that the "it’s the language to script java objects" rationale was a post-hoc justification of the decision, but I have no hard data with which to back up that claim.

    VBScript was from day one intended to be a "glue" language, but I don’t think that we were _particularly_ surprised to discover people writing server applications in it. ASP was the primary internal customer for VBScript 2.0, after all, so we knew that people would be doing a lot of server-side programming with it.

    I continue to be surprised, however, at the number of people who try to write really buff, heavy-duty applications in JScript (and, to a lesser extent, VBScript) only to discover that they’ve built a mess. I guess what surprises me is not that it happens, but that it happens to people who should know how to build and test large-scale applications.

  6. Dan Shappir says:

    > I continue to be surprised, however, at the number of people who try to write really buff, heavy-duty applications in JScript (and, to a lesser extent, VBScript) only to discover that they’ve built a mess.

    Whoa, that’s an interesting comment coming from a JScript guru! So, in your opinion JScript is inappropriate for constructing buff, heavy-duty applications? Why is that? I can personally think of only one reason: the weak type-system, but that is shared to some extent with other languages, such as Python or Ruby. Are they also inappropriate?

    Also, if JScript is inappropriate, what makes JScript.NET appropriate? Or is it also inappropriate in your opinion?

    I’ve personally built buff, heavy-duty that made substantial used of JScript. If anything, I found the browser DOM to be the source of more limitations than the JScript language. Likewise, I believe the ASP model of mixing UI, data manipulation and business logic, is much more at fault than any particular programming language used for it. In this sense, ASP.NET perpetuates some very bad programming practices.

    BTW, for an example of buff, heavy-duty application written in JScript (though not by me) check out Xopus: http://xopus.com/

  7. Eric Lippert says:

    JScript was designed to add simple functionality to web pages, not to afford creation of operating systems, database management systems, signal processing, and other large-scale, computationally intensive tasks. There are lots of things missing which are found in application languages — a type system, a module system, strong compile-time analysis, generation of high-performance machine code, etc, etc, etc.

    That’s not to say that it’s impossible to write heavy-duty application software in JScript, just that there may be more appropriate languages.

  8. Dan Shappir says:

    It seems then that the issue is that we have a different definition of what constitutes a heavy-duty application. Not surprising as this is a rather fuzzy term.

  9. Ian Hickson says:

    BTW, I think the JavaScript name came from a Sun request to push the name Java, not a Netscape wish to use the name Java.

  10. Peter Torr says:

    Well if you check the trademark (www.uspto.gov), it is owned by Sun…

  11. Mark K says:

    Sun bought Netscape long after the naming, so current trademark ownership means nothing. Nice try, though. 🙂

  12. Eric Lippert says:

    Nice try Mark, but Sun never bought Netscape. AOL bought Netscape.

    Let me clear this up. Yes, Sun owns the trademark on "JavaScript".

    Netscape created a language called "LiveScript" and renamed it "JavaScript" for a variety of reasons.

    Sun owns the trademark. Netscape licensed the trademark from them, and now since Time Warner owns AOL which owns Netscape, Time Warner owns that license.

Skip to main content