ഒരു പാവം ബോറന്‍റെ ചില അറുബോറന്‍ ചിന്തകള്‍...,...
ചിരിക്കണോ കരയണോ അഭിപ്രായം പറയണോ ആക്ഷേപിക്കണോ എന്നൊക്കെ വായിക്കുന്ന ബോറന്/ബോറത്തിക്ക് തീരുമാനിക്കാം...

Friday, June 17, 2011

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!

No comments:

Post a Comment