Developer

Scripting languages

Easier to use than traditional compiled programming languages, scripting languages have become widespread tools for enhancing network and Internet functionality. Steve Goldberg explains which scripting languages are the most common and why.


Scripting languages are, in general, computer languages that are handled by an interpreter rather than compiled directly into an executable program by a compiler.

An interpreter is a program that examines each line of code at the time the user invokes the script, checks it for correct syntax, then executes that code. Scripting languages generally are less complex than traditional compiled languages. Script programs take longer to run than compiled programs, since they first must be handled by the interpreter rather than executed directly by the CPU.

Because of their less-complicated nature, scripting languages are easier to learn and use than traditional compiled languages. Scripting languages tend to be extensible to handle tasks that weren’t initially conceived by their developers. They can readily tie together tasks, such as preparing input for use by other programs, running those programs, and formatting the output. Another important characteristic of common scripting languages is that they tend to be cross-platform, with versions often available for UNIX, Windows, Macintosh, and other operating systems.

Among the more common uses of scripting languages is the production of Common Gateway Interface, or CGI, scripts. CGI scripts let Web browsers make use of programs running on a Web server.

Common scripting languages
Common scripting languages include Perl, JavaScript, VBScript, Tcl, and REXX.

Perl
Perl was invented by Larry Wall, a UNIX guru. The name is an acronym for Practical Extraction and Report Language. (It was humorously referred to in a definitive Perl textbook as Pathologically Eclectic Rubbish Lister.)

Perl is probably the most common language used for CGI scripts. Its syntax is similar to C. Variables used in Perl are not as strongly typed as in traditional languages; the type of a Perl variable is dependent on context. Perl is an excellent text manipulation language and is especially proficient at parsing delimited text files.

Versions are available for UNIX, 32-bit Windows platforms, and Mac. Perl applications process e-mail, create databases, and perform other complicated tasks. The language has object-oriented extensions, and there is a wealth of extant routines available for Perl.

For more information on Perl, visit these resources:

JavaScript
JavaScript is an object-oriented scripting language that was originally developed by Netscape to be small and lightweight. According to Netscape, it was designed specifically for embedding in other applications, especially for use with Web browsers.

The language is designed to work with a core set of objects, known as Core JavaScript, and is commonly extended by supplementing it with additional objects, most commonly Client-side JavaScript and Server-side JavaScript. Client-side JavaScript consists of objects specifically designed to control a Web browser and its Document Object Model (DOM).

Client-side extensions might be employed to add functionality to an HTML form and react to associated events, such as mouse clicks, form inputs, and page navigations. Server-side JavaScript extends the language to perform server-executed functions, such as a database search.

JavaScript resembles Java in that they largely share the same syntax. Again, like Perl, JavaScript is not a strongly typed language; variable types are dynamic rather than static. While it is object-oriented, it is not class-based, and inheritance varies with the object in question and is not hierarchical in nature. Unlike Java, JavaScript does not create applets, but it’s generally interpreted by Web browsers. JavaScript can be used to tie Java applets to HTML code.

Netscape has been working with ECMA (European Computer Manufacturers Association) to develop a standardized version of JavaScript, known as ECMAScript.

For more information on JavaScript, visit these resources:

VBScript
VBScript is a subset of Visual Basic specifically designed to be lean and mean enough for application in the Web-centric world. It’s engineered to be cross-platform and interacts with ActiveX Controls and Java Applets.

Like JavaScript, VBScript, officially known as Microsoft Visual Basic Scripting Edition, can run client-side on a Web browser, especially Internet Explorer, and server-side on the Web server, especially Microsoft Internet Information Server (IIS).

VBScript does not strongly type its variables; the interpreter recognizes the context of variables and deals with them appropriately. It is object-oriented, supporting a limited amount of Internet-related objects and any objects provided on a particular Web site.

For more information on VBScript, visit:
  • Microsoft’s Windows Script Technologies VBScript

  • Tcl
    Tcl, or Tool Command Language, was developed by Dr. Jon Ousterhout at U.C.-Berkeley, and until recently, the language was developed and maintained by Sun Microsystems. Tcl grew out of Dr. Ousterhout’s needs while he was working on tools for designing integrated circuits. Dr. Ousterhout has now founded the Scriptics Corp., which basically spun off Sun and has now taken over the development and distribution of Tcl. Tcl is an open source language; extensions can be contributed by any member of the Tcl community.

    Like other scripting languages, Tcl is extensible, portable, and easy to use. The Tcl interpreter is mainly a collection of C language functions, making it especially easy to extend by writing new C functions. Tcl comes with Tk, a programming environment specifically geared to designing Graphical User Interfaces (GUIs) in the X Windows environment and other graphical environments, such as Mac and all versions of Windows.

    REXX
    REXX, or Restructured Extended Executor, was developed by Michael Cowlishaw of IBM U.K. Laboratories for users of large mainframe systems. The language was ported to OS/2 when that environment was developed; OS/2 now is the primary platform for REXX. REXX originally was developed as a procedural language, but it was also designed for incorporation by other languages as a macro language. As in the other languages we have discussed, its variable types are recognized by context rather than by declaration, and it’s highly portable. IBM has now developed an object-oriented version of REXX known as Object REXX.

    For more information on REXX, see:
  • Eric Giguere’s FAQ about REXX

  • Conclusion
    Many other scripting languages are available today. All these languages have a lot to offer, and your background will certainly help you choose the one best suited for your task.

    Editor's Picks

    Free Newsletters, In your Inbox