Guest Column: Scripting offers cost effective development

In a previous column, (“Using Tcl as your scripting language,” CWC, March 26, 1999, pg.13), I discussed evolving legacy character-based applications into client-server GUI applications using a scripting language like Tcl for the client side development. In this column I will focus on presenting scripting languages as a cost-effective option for development of ‘serious’ applications.

My personal choice is Tcl (, but some or all of what I will discuss will apply equally to Python (, Perl (, Visual Basic, JavaScript and other scripting languages.

Tcl, Perl and Python, being open-source and multi-platform, are often grouped together and their comparative advantages are debated.

There is a common feeling among developers that scripting languages are tools for system administrators (most likely of Unix systems) or CGI authors and are too unsophisticated and slow (being interpreted) to be used in any but the simplest projects.

Although there are certainly situations where it is necessary to code in lower level languages, by far, most tasks (for example, graphical interfaces, network I/O, word processing, file processing, small databases and animation) are easily handled by scripting languages on today’s machines.

Use of scripting languages has been proliferating in recent years. They are easier to learn and easier to program than lower level languages. Projects can be completed more quickly than when using lower level languages.

Prototypes can be developed rapidly (see example below), development cycles can be shortened and modifications can be made with comparative ease. If an application must run on multiple operating systems or processors, a multi-platform interpreted language can allow the same code to be distributed to each.

As I mentioned above, Perl, Tcl and Python now work on Microsoft Windows, multiple flavours of Unix and the Mac operating system.

Tcl is also easily extensible to include another application or additional commands. Tcl has numerous extensions and code libraries available for tasks like graphics, networking, development tools, database connectivity and object oriented programming. A few examples of extensions are oratcl (Oracle and Tcl), [incr tcl] (object-oriented tcl), a package of commands to modify the Windows registry, http, and tk-dp (distributed processing).

Scripting languages are often used as ‘glue’ to join existing applications. For example, the scripting language might provide the user interface to call a database application which outputs a file and then call a C program to reformat its outputted file into HTML and add an image. It may then modify the file to satisfy a requirement which changes weekly, since scripting languages are modified with relative ease. Finally, it would allow the user to copy the final

version to one of a choice of ftp servers.

Tcl, Perl and Python are open-source and free. They have substantial unofficial support from their on-line communities. This may vary with the platform on which it is being used, so I recommend choosing a language which has a strong base on your platform.

To demonstrate how advantageous the flexibility of scripting can be, let me offer a brief example. A project requires that remote clients access the local system via the Internet. There need to be various menu choices and editing features on the clients as well as the ability to display a downloaded image. A prototype for this system could realistically be produced in a week’s time.

To illustrate how powerful these languages can be, the following lines of Tcl build a window with a text box and two buttons labelled “Clear” and “OK.” When pressed, the button labelled “OK” retrieves multiple lines of text from

the server and displays them in the text box. The button labelled “Clear” clears the text box.

———- program code snippet —————

set socket [socket 5555]

text .t -height 20 -width 60

frame .bottom

button .bottom.ok -text OK -command {

puts $socket “GET_DATA”

.t insert end [gets $socket]


button .bottom.c -text Clear -command {.t delete 1.0 end}

pack bottom.ok .bottom.c -side left

pack .t .bottom

———- end of code snippet —————

I must stress that this is not production quality code; the socket would block until it receives its data, likely locking the application. However, if in 10 lines, a working module is created, one can extrapolate to prototypes that are created in days instead of weeks and projects that are finished in weeks instead of months.

Scripting languages have code that is easy to understand, thus their code is easier to maintain, especially for a developer who is not the author. Similarly, a change in a project’s design causes less of a setback to the schedule than a comparable change in a project using C, C++ or Java.

With the maturity of these powerful languages, project managers now have an alternative to conventional compiled languages and if the application is suitable, can save time and lower cost.

Those interested in more information on Tcl, Perl or Python should start with the Web sites mentioned at the beginning of the article.

Karen is a software consultant and a member of Toronto Internet Developers Association ( He can be reached at