Geek Page - Scripting Languages

Programming for the masses.

The development of fancy graphical interfaces has finally made computers usable by normal humans. But computer programming remains an arcane art, understood only by members of the technical priesthood. This will have to change. A growing community of digital artists and other right-brained types are beginning to demand the power and flexibility that can only be achieved with programming.

A good example is the animation and special-effects industry. If you see a complex video effect on TV, like a dancing gas pump, chances are it was created by programmers. Buttons and menus can't provide the control that such artistic effects demand. The same phenomenon recurs in CD-ROM production, Internet publishing, and even mundane (but complex) tasks like system administration.

All these jobs would become much easier if specialists could work directly with the computer, instead of relying on programmers to interpret their ideas. Unfortunately, we can't force artists and system administrators to learn traditional programming - or expect programmers to be artists. Instead, we need to find some way to make computer programming so easy that anyone can do it.

The answer lies in the nascent field of scripting languages. Scripting languages, such as Lingo and Tcl (pronounced "tickle"), are programming languages that are very easy to learn and use. Scripting gives non-technical users a richer, more expressive way to work with computers. And even trained programmers are starting to use scripting languages to quickly create simple applications.

For example, in Tcl/Tk (which combines the Tcl language with a tool kit for building graphical interfaces), you can create a working application with only two lines of code:

button .myButton -text

"Hello" -command exit

pack .myButton

When you run this script, it displays a window with a button in it. Click on the button, and the program exits. It's simple, but the same program written in C, with an interface tool kit comparable to Tk, requires a full page of ugly code.

That's pretty impressive, and it doesn't involve any revolutionary technology. Scripting languages just have a different emphasis. Like the Macintosh, they're the same old tools, with a new user interface.

The simplest way to put a user interface on programming is to make it prettier. Conventional programming languages look like physics formulas, with thickets of punctuation. Scripting languages are more attractive. An extreme example is Apple's HyperCard, which looks a lot like English. Instead of "a = b", a HyperCard user says "put a into b." This enchants users at first, but the extra verbiage can come to seem clumsy.

Another common-sense approach to making languages easier to use is to make them more powerful. A C programmer works directly at the level of the machine, pushing around various bits and bytes. If more sophisticated operations are built into a language, it is easier to write more sophisticated jobs. For example, the concept of character strings isn't built into C, so users have to call an external function to connect two strings - "strcat(a,b)". Most scripting languages have strings already built in, so users just say "a+b".

These simple techniques help make programming more manageable. But as any amateur programmer can tell you, the trickiest part of programming is thinking like a computer. The sheer power of the machine is intimidating. So, just as the Macintosh masks the power of its file system with the metaphor of a desktop, good scripting languages use interface metaphors to make the computer look friendlier and less powerful.

C's interface model, for example, is procedural. A program is a collection of subprograms, called procedures; the machine can leap from one to another at any time. It's a powerful metaphor, but keeping track of where the flow of control is coming from and where it's going to requires serious concentration.

Scripting metaphors tend to be easier. Many scripting languages aimed at system administrators, like Tcl and Bourne shell, share the batch metaphor. The script is a list of commands, executed one after another, exactly as if the user had typed them at the command line. The infamous AUTOEXEC.BAT file, found in MS-DOS, is a common batch script.

The batch metaphor still lets advanced users define new commands - giving it the same power as the procedural model. However, novice users can invoke system commands without having to understand the control-flow model behind them. They don't need to learn any concepts to write their first script.

A third interface metaphor is the object-event model, common in multimedia scripting. Here, the user defines the application in terms of concrete objects. An object might be a button, a picture, or an animated cartoon character. The objects respond to events, like mouse clicks, by executing batch-like scripts. It's a sophisticated control-flow model; but, for each object, the user thinks only in sequential terms.

None of these metaphors makes scripting languages fundamentally less powerful or efficient than their conventional counterparts. However, most modern scripting languages haven't been engineered to provide the horsepower necessary for heavy-duty programming. In order for artists and engineers to cooperate in the digital era, a new generation of industrial-strength scripting languages needs to be developed. Curtis Yarvin (curtis@xaostools.com) would say more , but his employer, Xaos Tools Inc., might not dig it.