Accelerate your application development by “gluing” together Java pieces — that’s the promise of a new freeware product from SunScript, a business group of Sun.
On October 25th, SunScript team leader Raymond Johnson e-mailed leading developers his announcement of the alpha release of Jacl and Tcl Blend. While early interest was concentrated in the Tcl community, Tcl Blend stands on its own as a useful tool for Java developers with no background in Tcl. The first beta release on December 19th, 1997, gives Java a powerful way to achieve better programming results with less coding.
People usually talk about Tcl as a “scripting language.” “Scripting” involves introspective interpretation of a language with a simple syntax. Tcl is also a kind of “glue”; it offers a variety of robust techniques for getting components written in different languages to play together nicely.
Part of the reason for its decade-long growth, though, is that it’s more than just a language. It’s an entire technology framework. A couple of fundamental elements — portable scripting and “gluing” — combine to yield a bewildering variety of tools.
- highly portable and dynamic GUI development
- automation of system and network administration
- compact control of embedded systems on oil rigs, space craft, submarines, merchant ships and other “mission-critical” devices
- management of million-line test suites
- easy-to-use extensions to Web servers; and much more.
The new SunScript products, Jacl and Tcl Blend, give Java developers quick access to these proven successes.
The qualities of scripting make Tcl a valuable complement to Java. Java is a strongly typed compiled language, designed for methodical construction of even the largest projects. Tcl is ideal for interactive programming. It permits highly dynamic run-time management of language constructs. Moreover, its “gluing” capabilities make it a good alloy with Java. Let’s step through an example to see how this can work for you.
First, a bit of vocabulary: SunScript re-uses the same technology for several distinct tools. “Jacl,” in the narrow sense, is an implementation of Tcl written in Java, rather than its historic C coding. Jacl’s main users are existing Tcl developers who want to port their application to Javastations or other JVM-enabled environments.
Sometimes Jacl is used as an abbreviation for “Jacl and Tcl Blend.” The Tcl Blend half is a conventional Tcl — one coded in C — that’s been enhanced. It has Java Native Interface implants and the strength to load Java classes and Beans, examine them and invoke their methods.
Johnson explains, “the way we have been trying to use our terms as of late is more like this:
Jacl: A 100% Java version of Tcl.
Tcl Blend: An extension to the Tcl and Java VM’s to allow them to work together. I.e., Tcl can load and manipulate the Java VM or Java can load and manipulate the Tcl VM.
The Java Package: A new set of Tcl commands available for both Jacl and Tcl Blend that allow you to interact with Java directly from Tcl.
The Tcl extension APIs for Java: These are Java APIs for creating and manipulating Tcl interpreters from Java. These APIs are used for writing new extension for Tcl in Java or adding scripting capabilities to existing Java applications.”
Tcl Blend’s place in the world
These capabilities make Tcl Blend useful in several roles. Many organizations, for example, have made strategic commitments to migrate legacy code to Java. Some, like the programmers of the West++ modeling application, are already exploiting Tcl Blend to ease this transition. In this scheme, Tcl Blend is a high-level manager which sits atop legacy and Java components. The application can be reliably maintained while pieces of functionality are incrementally re-written in Java. Customers see a system which is available continuously, with no “Big Bang” switchover from a completely old technology to a completely new one.
A second role for Tcl Blend recognizes that Tcl remains ahead of Java for addressing specific types of problems. Manipulating the Windows registry, for example, is a particular strength of Tcl. Java programmers who want easy access to the registry use Tcl Blend to bring that strength into their Java development.
Tcl “extension”-writers constitute a third category of use. Programmers who breed a modified Tcl with new capabilities — an extension — traditionally do so with C-coded modules. Tcl Blend makes it easy to implement those external pieces in Java, and the result has the usual advantages of Java compared to C. Researchers at the University of Minnesota, for instance, have built a multimedia synchronization toolkit based on the Java Media Framework. The toolkit will ease construction of video and audio conferencing and playback systems.
The example below models yet a fourth use for Tcl Blend: new Java development. We’ll see the convenience Tcl affords in experimenting with Java classes as they’re written. David Beazley of the University of Utah has written several articles on the use of scripting languages as disposable “scaffolding” for projects with compiled deliverables. While his work has just begun to touch on Java, the principles he explains certainly apply.
Setting up Tcl Blend
To set up Tcl Blend, you first need to get it working on a machine that’s handy for you.
SunScript advertises Tcl Blend’s current availability only for Win95, WinNT and Solaris. Enthusiasts are already finding it more or less ready-to-go under Irix, Linux, AIX, FreeBSD, HP-UX and Digital Unix. Platform difficulties, by the way, don’t come from the Tcl side of Tcl Blend. The portability of Java remains more image than reality.
Christopher Hylands, Ptolemy Project manager at UC Berkeley, maintains the most complete set of installation notes for Tcl Blend. An NT installation, for example, goes this quickly:
- Install JDK 1.1.
- Install Tcl8.0.
- Download Tcl Blend into a temporary directory. It’s only a few hundred kilobytes.
- Launch the installation,
within your temporary directory.
- From the Windows Start button, start “Tclsh,” a console for the Tcl interpreter.
- At the tclsh prompt:
package require java
Adjust the directory names if you’ve installed your packages in non-standard locations.
Once you’ve verified everything is working, you can automate the startup sequence above.
- At this point, you’re in charge of Java through the tclsh prompt. You can start Java by popping up a Java frame:
set x [java::new java.awt.Frame]
$x setSize 200 200
You’re in business!
Tcl Blend for the working Java developer
Several toolsmiths are already crafting utilities with Tcl Blend which improve Java working environments. Hylands is leveraging Tcl’s success in quality assurance to simplify regression testing for Java developments. Krishna Vedati has launched a startup which will soon release a couple of portable freeware tools. His JExplore browses the Java API interactively, and JInspect is a powerful “class debugger.”
Steve Ball, Webmaster for Plume, has generously made public the chapter on Tcl and Java from his forthcoming book, Web Tcl Complete. This is the best documentation now available for Tcl Blend. It includes several tips and ideas which benefit Java programmers.
In the following section, we take a couple of easy steps to simplify Java programmers’ jobs.
Your assignment: RFC822
Suppose you’re writing a Java class for managing RFC822 documents — the “ARPA Internet e-mail” format now used for newsgroup postings, newswire services, and so on. You’ve got a choice. Once you’ve started writing your
- write “drivers” for it. This involves the creation of complete small applications to exercise your class’ functionality. You then cycle through the edit-compile-execute waltz, first to test your drivers, then finally to validate your class.
- streamline the previous process with one of the Integrated Development Environments available (if there is one available for your platform and budget).
- launch Tcl Blend, and immediately begin to verify interactively that your class works to your standards.
With Tcl Blend, you can create an instance of your new class,
set my_object [java::new RFC822]
and point it to an input source.
You might start testing out the methods you’ve defined.
puts “The ID of the current message is
puts “The text of the current message is
You can ask the class the characteristics of its methods or attributes.
java::info methods RFC822
java::info fields RFC822
And, because Tcl Blend is built with Tcl, you have all of Tcl’s resources immediately available to you. You can test interactively; you can programmatically control any part of your class; you can log a history of your commands and results; and much more. It’s a developer’s dream!
Faults in Tcl Blend
Tcl Blend is useful now. It also has a long way to go. Johnson projects the final release for “February or March.” Only then will the SunScript team compile a public list of known defects. Early users are already filing their own requests for the next round of releases. Most of the deficiencies appear to be minor, and Hyland’s page details a few patches that are circulating among early adopters.
At least one problem appears to be deeper. Bob Jackson of the Space Telescope Science Institute has as his “goal … to enable Tcl to talk to CORBA and RMI remote services.” While Tcl Blend has worked for him on the client side, his attempts to access the server-side org.omg Java ORB facilities have all been stymied under Solaris.
Asked where he’ll steer Tcl Blend next, Johnson told us,
“We are working on a Tcl Bean for Java Studio that will allow Studio users to define new functionality with Tcl. A working prototype of the Bean should be made available for Java Studio users in the first quarter of 1998. The final feature set and a schedule for a final release will be based on user response.”
The biggest questions about Tcl Blend are on the business, not the technical, side. Tcl Blend emerges in a particularly curious scene. Sun is a large, successful, growing company that has staked its future on Java. It generously supports the SunScript research and development team. Scripting is a great idea, with applications all around Sun Microsystems. Java in particular needs a high-productivity alternative to its current programming models. The Tcl Blend development team has mapped out clear plans to add functionality to Java.
And yet, Sun doesn’t seem to realize what it has at SunScript. Hylands points out that the JavaSoft pages make no mention of Tcl Blend. In fact, it rather confusingly has introduced a database product which it calls both JavaBlend and Java Blend. Not only is this a different technology blend, it has an entirely different commercial focus — one apparently aimed at “Fortune 1000 companies.” Also, Sun enrolled as a founding member of the Tcl Consortium this fall, yet hasn’t yet issued a press release about its sponsorship. Anomalies like these have led to recurrent rumors that Sun is ambivalent about its support for SunScript.
The truth seems to be this: Sun is still absorbing all the change Java brought. At the same time, it remains “a very 3GL [third-generation language] company,” as one insider told us. Tcl Blend offers order-of-magnitude improvements to Java developers. Precisely because its advantages are so radical, it takes the Sun organization a little extra time to understand what it has. We developers don’t have to wait for Sun’s corporate enlightenment, though. We can put Tcl Blend to work for us right now.
Cameron Laird and Kathryn Soraiz manage their own software consultancy, Network Engineered Solutions, from just outside Houston, Texas. Ask questions and request notice of upcoming articles by e-mailing firstname.lastname@example.org. Updates on the subject of this article are available.