In the spirit of dynamic languages like Smalltalk, Ruby and Python, the values rather than the variables are strongly typed. Unlike these languages, however, objects are cloned from prototypes rather than instantiated as instances of classes in the spirit of the pioneering prototype based language Self. Prototypes can have state (properties) and behavior (methods) modified on the fly. In this regard, JS is much more dynamic than its class based cousins. It is still very straight forward to do class based OO programming in JS and there are patterns and libraries for applications where this is appropriate. JS has a basic but sufficient set of base classes. Unfortunately, there is no explicit mechanism for dealing with name scopes so this means developers have to provide their own name space management. It isn't that it isn't possible to write packaged code, rather that there are problems when one includes code from a large number of sources where one can get name conflicts, especially for selectors.
Like most OO languages, input and output is done through a library, which for the browser is the DOM. While the language isn't without its share of small but irritating syntactic and semantic anomalies, it is more than good enough for serious web work. JS has been plagued by the DOM2 and the associated browser dependence and defect levels. Fortunately, browser standardization and improved test suites for HTML, CSS and DOM practices have significantly improved cross browser programming though it is still frustrating at times.
Standards are an important way to ensure portability of programs. Recently, the ECMAScript (ES) 3.1 and 4 efforts were merged with the near term focus on the delivery of the more modest ES 3.1 standard. ES 3.1, expected out in 2009, is being designed to ensure that existing web pages don't break.
Major features tentatively approved include:
ES 4 was very ambitious and advocated the addition of a lot of complex Java-like machinery such as manifest types, generics etc. which have already proved difficult for professional Java developers. One hopes that the ES efforts beyond 3.1 will focus on small critical issues like proper name spaces and reducing language ambiguities rather than complicating the language. It is important to note that many issues such as the DOM, security, and potentially even name spaces are at least in part outside the scope of the ES language standard.
One of the major factors limiting developers was a lack of the industrial strength programming environments they had come to love. It is important to know that early JS developers assembled a toolkit that is still in wide spread use today. JSLint and JSUnit are two notable stalwarts in this toolkit. Agilists may even argue that the lack of tools forced JS developers to apply test first programming3 rather than leaning on their IDE and its debugger. While there has been a lack of good tools for many years, this has been improving substantially of late. Eclipse based tools such as Adobe Flex Builder, JSDT, MyEclipse etc., and MS Visual Studio provide IDE support for developers.
Since the arrival of Google Mail and Ajax there are some good libraries such as DoJo, jQuery and more recently the highly polished EXT JS library. These libraries provide for Class OO programming; support for XML/HTML; support for Ajax XMLHttp, REST or, JSON; UI widgets and numerous utilities for common tasks. Prototype + Script.aculo.us, DoJo, jQuery, MochiKit, YUI and Ext JS etc. eliminate the need for building such things oneself. OpenAjax has over a hundred members collaborating to harmonize libraries and their component models.
Occasionally disconnected operation is one of the major challenges for browser based applications, which have been until recently dependent on an always available Internet connection. Mobile applications in particular are constantly disconnecting and connecting. Gears is a first attempt by Google to enable simple web programming on the client using an embedded web server and SQL DB. Microsoft and others are working on more elaborate Sync frameworks which would enable syncing application and server data.
Google Open Source V8 Challenges the Industry
With V8 Google has thrown down the gauntlet to the major platform and VM vendors, challenging them to improve their offerings. For many years industrial strength dynamic VM technology has been proprietary to major corporations such as IBM, MS and Sun. Google V8 will be developed in the open under a BSD license ensuring that researchers, hobbyists and competitors can watch and benefit from the V8 code base. Of particular interest to dynamic language advocates are the engineering design decisions which strongly support JS as a dynamic language. The benchmarks in particular bring smiles to the faces of many savvy Smalltalk developers.
Application Developers – Time to Tool Up for JS
3 "Debugging Sucks, Testing Rocks" http://googletesting.blogspot.com/
About the author