Tuesday, May 20, 2008

JavaScript: A Language for All

The Java language is derived from C and C++, but it is a distinct language. Its main audience is the experienced programmer. That leaves out many Web page authors. I was dismayed at this situation when I first read about Java’s specifications.

I would have preferred a language that casual programmers and scripters who were comfortable with authoring tools such as Apple’s once-formidable HyperCard and Microsoft’s Visual Basic could adopt quickly. As these accessible development platforms have shown, nonprofessional authors can dream up many creative applications, often for very specific tasks that no professional programmer would have the inclination to work on. Personal needs often drive development in the classroom, office, den, or garage. But Java was not going to be that kind of inclusive language.

My spirits lifted several months later, in November 1995, when I heard of a scripting language project brewing at Netscape. Initially born under the name LiveScript, this language was developed in parallel with Netscape’s Web server software. The language was to serve two purposes with the same syntax. One purpose was as a scripting language that Web server administrators could use to manage the server and connect its pages to other services, such as back-end databases and search engines for users looking up information. Extending the “Live” brand name further, Netscape assigned the name LiveWire to the database connectivity usage of JavaScript on the server.

On the client side—in HTML documents—authors could employ scripts written in this new language to enhance Web pages in a number of ways. For example, an author could use LiveScript to make sure that the information a user enters into a form is of the proper type. Instead of forcing the server or database to do the data validation (requiring data exchanges between the client browser and the server), the user’s computer handles all the calculation work—putting some of that otherwise wasted horsepower to work. In essence, LiveScript could provide HTML-level interaction for the user.

As the intensity of industry interest in Java grew, Netscape saw another opportunity for LiveScript: as a way for HTML documents (and their users) to communicate with Java applets. For example, a user might make some preference selections from checkboxes and pop-up selection lists located at the top of a Web page. Scrolling down to the next screenful, the user sees text in the Java applet scrolling banner on the page that is customized to the settings made above. In this case, the LiveScript script sends the text that is to appear in the scrolling banner to the applet (and perhaps a new color to use for the banner’s background and text). While this is happening, the server doesn’t have to worry a bit about it, and the user hasn’t had to wait for communication between the browser and the server. As great an idea as this was initially, this connectivity feature didn’t make it into Navigator 2 when JavaScript first became available.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home