10 reasons why Javascript is the ultimate scripting language

Start counting:

1.) C-like syntax

The basic Javascript syntax fairly resembles C and since this language is an integral part of Computer Science curriculums all over the world, this means that developers are familiar with it, hence an easy leaning curve.

2.) OO syntax mimics Java

Again because Javascript was designed to have a similar look to Java, but be easier for non-programmers to work with its syntax is (fairly) understood by the vast majority of programmers.

I use the word “mimics” because the prototypical nature of JavaScript makes it very-very different from languages with class based inheritance (like Java or C++). Actually JavaScript is the only prototypical language that has managed to become mainstream, so JavaScript mastery is actually quite hard and requires lots of work!

3.) Omnipresent in HTML scripting

You know it for more than a decade: if you want even the simplest form of dynamic functionality on a web page you need to write some Javascript. For a pop-up window, for client-side form validation, for a calculation, everything melts down to Javascript. There is the alternative of VBScript on IE but since it is not compatible with all the browsers its application is minimal.

The fact that Javascript has been ubiquitous for a decade in web development means that its basic syntax can be considered a common knowledge for developers, and the advanced features have an easy learning curve.

4.) AJAX

In the world of Web2.0 it is essential for a developer to understand advanced Javascript. There might be various other approaches for RIAs but still Javascript and XMLHttpRequest is king.

5.) Adobe AIR

Currently there is a big effort to provide web developers with tools that ill allow them to build lightweight desktop applications, blurring the line between the two realms. In that direction Adobe has released AIR (Adobe Integrated Runtime) formerly code-named Apollo which is a cross-operating system runtime that allows developers to use their existing web development skills to build and deploy rich Internet applications to the desktop. Although you can use Adobe Flex for AIR applications my guess is that developers will favor the Javascript approach.

6.) Google Gears

As I have pointd out in an older post, Google has rolled out Google Gears their open source browser extension that enables web applications to provide offline functionality using…. what else? JavaScript.

7.) Mozilla Rhino

While many sweat to develop their scripting interfaces to Java, Mozilla Rhino has been there for ages and works! Again Rhino uses Javascript.

It just listened to a podcast this weekend from the founder of Alfresco the Open Source Alternative for Enterprise Content Management (ECM), that emphasized on the fact that they are slowly abandoning their direct Java development model and are increasingly using Javascript (Rhino) for scripting and interfacing with Java libraries.

8.) Editing XML via DOM

Javascript has a robust, time proven implementation of DOM that makes it a worthy candidate for handling all kinds of XML vocabularies that a developer encounters.

9.) JSON

Although nowadays you can find language specific implementation of this elegant data interchange format in many languages, it was originally used in Javascript and still most applications involve Javascript-based AJAX applications.

10.) Prevalent support and acceptance

Even though it was the child of Netscape and its name “Javascript” is a Sun trademark, it enjoys acceptance by most vendors and has several implementation in various domains. Even MS has an implementation that bears the name JScript in order to avoid trademark issues

For all the above reasons I suppose it would be a good investment for a developer to brush up on his Javascript knowledge, going beyond basic syntax and applying methodologies like unit testing.

UPDATE: More stuff from Stevey’s Blog Rants: Rhino on Rails:

11.) Performance

“Rhino, in contrast, has a great deal of momentum. It’s been around even longer than Jython; it began life as a port of the SpiderMonkey (Netscape/Mozilla) JavaScript C engine, and it was written with an eye for performance. The Rhino code base reads almost like C code: it avoids allocation and does as much as possible with jump tables to avoid the overhead of virtual method lookups. It has two code paths: a bytecode interpreter that runs in a tight loop, and an optimizing Java bytecode compiler that turns many expensive-ish JavaScript property lookups into Java local or instance-variable lookups.”

12.) Specs

Unlike ALL mainstream scripting languages like Perl, Python, etc.Ruby Javascript actually has a real specification.

13.) JDK Support

Bundled in Java 6 it will be javax.script.

UPDATE #2: While going through the book “Understanding .NET” (by David Chappell) I found out something I didn’t know:

14.) JScript.NET

Visual Studio also supports JScript .NET and because it’s based on the CLR, the .NET version of JScript also implements CLR-style classes, which can contain methods, implement interfaces, and more. JScript can be used for creating essentially any .NET application!

Social Bookmarks:


9 thoughts on “10 reasons why Javascript is the ultimate scripting language

  1. …not to mention the fact that Javascript is also one of the most unreliable languages in cross-browser testing. Good article, though.

  2. Yes Ron, you have a point there 🙂 Designing heavily interactive web pages with Javascript is a science of its own, but still it is the easiest way to go about it. Sure there are corner cases, but most of the times you can create the sweetest products. It’s no wonder why its is a strategic choice of the almighty Google!

  3. This article’s five years old, 2007 was a happier time, before anyone really asked JS to do anything challenging. Now, of course, thanks to Steve Jobs, thousands of clueless drones who wouldn’t know a function if it forced its return type up their arse screech about how ‘HTML5’ (lots and lots of JS) is ‘the future’, Flash/Native is ‘rubbish’ next to it, how it’s ‘easier’ etc etc. As a developer working in HTML, Flash and Java, it’s really depressing – JS is near-impossible to write complex applications in because IT WASN’T DESIGNED FOR THAT. No type-checking, the most ridiculous inheritance and OO system for said purpose, inconsistent browser implementation, you name it and JS is probably shit at it.

    The whole language is basically a massive hash-map – don’t get me wrong, for adding functionality and little tricks to HTML pages, it’s awesome and easy, but what seemed to start as a little vendetta against Adobe by the sociopathic Jobs has turned into something really quite surreal, where we’re having to dump years of experience writing high-end applications in real languages, to ape them using HTML and a scripting language, because a lot of people with no knowledge at all believe that ‘it’s the future’. Have you ever tried to make a game in HTML5 canvas? I’m doing that at work at the moment. If you’ve ever used Flash it makes you want to cry – what I could do in a matter of hours in that has taken several days of painfully vague error messages here!

    JS is ubiquitous, yes, but so is dogshit on your average street. I hope, now Jobs is gone we might approach the issue with a little less hysteria, we badly, badly need an alternative. Google dart is an honest attempt to do this, but it’ll never get adopted, least of all by ‘we love open standards’ Apple. It’s a real shame.

  4. Javascript has only one advantage and thats the fact that all web browsers have a javascript engine built in , so that means nothing to install or download. My favorite language Python is so hard to distribute because people dont like to install stuff, not to mentions the installation of the massive gtk or qt libraries for any GUI stuff. So here we are with javascript and nothing else. I am hoping that soon somebody sane will get a decent interpretor as standard in a browser so we can all go home and enjoy the computing experience.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s