New Tricks for an Old Dog


To the delight of its loyal user community, Smalltalk shows no signs of fading away in the face of today's newer object-oriented languages. Indeed, recent developments in language design are making Smalltalk more popular and useful than ever before.

by Hugh Ashton

While java hogs the limelight as the crowds "ooh" and "aah" over portable object-oriented languages, Smalltalk -- the oldest object-oriented programming language still in common use -- continues to gain both mind- and market-share. First developed at Xerox PARC (Palo Alto Research Center), imitated by Objective-C (and, to some degree, by C++ and Eiffel), and now semi-cloned by Java, Smalltalk recently celebrated its 25th anniversary.

Spearheading the Smalltalk evangelical movement is Object Technology International, Inc. (OTI), a Canadian company long known within the industry as a source of software tools and expertise. Though purchased in February 1996 by IBM Canada, in keeping with IBM's new policies OTI has been allowed to maintain its own identity and ways of doing business.

From wristwatches to mainframes

During a recent visit to Tokyo, Kim Clohessy, OTI's Vice President of Embedded Systems, discussed Smalltalk's prospects. OTI's customers, says Clohessy, find Smalltalk's portability to be one of its prime virtues. Based (like Java) on a virtual machine running bytecode, Smalltalk applications can be run on a variety of common -- and uncommon -- platforms. In fact, Smalltalk is probably more common on "uncommon" systems. The machine from which you buy your train ticket, for example, or the automatic ticket wicket through which you pass must run some software -- and it's not Windows or MacOS.

The unofficial battle cry at OTI is "Smalltalk on everything, from wristwatches to mainframes!" Clohessy admits that OTI Smalltalk hasn't been ported to a wristwatch yet, but the company is working on a project with a customer to develop a training aid for athletes that is worn on the arm. That's close enough to a wristwatch for the slogan to remain valid.

OTI's Smalltalk can run on a number of ROMmable microkernel real-time operating systems (OSes), such as QNX and VxWorks, as well as on mainstream desktop OSes (Unix, Windows, etc.). But it can also be configured to run "on the metal" -- that is, with no operating system. While the theoretical minimum size for a Smalltalk application is about 10K, such an "application" can't do anything useful. The entire code for the athlete's personal trainer mentioned above, however, fits into just over 200K of ROM (read-only memory).

One interesting practical application that uses embedded Smalltalk is an 8-line PBX (private branch exchange) telephone system with integral voice mail. Designed to sell in the US for under $1,000 at non-specialist mass outlets, the application runs without an OS on Motorola's 68360 chip. The whole code (incorporating 500 classes) fits into under 2MB of ROM, and the system uses less than 1MB of RAM (random access memory). Most amazing, perhaps, is the time scale needed to develop the application: It took four engineers just nine months to bring the product to field testing, and a further three months to go to market.

Smalltalk's fast development times and small development teams are corroborated by numerous practical examples. EDS estimates that development time in Smalltalk is about one-fifth that of development in C++. And a European bank that recently rewrote its client management software using OTI's Smalltalk cut the size of its development team from about 1,000 (COBOL) to fewer than 100 (Smalltalk) programmers, who now write more complex systems in the bargain.

Given the high productivity rate of a Smalltalk programmer, OTI regards a team of six programmers as a "large" team, with greater communication within the team than is normally the case. In fact, since modifications to a Smalltalk system are so easy (at least, compared to those on a C system), often "domain experts" rather than full-time programmers will modify the code to produce results in real time. This is actually the case with parts of Canada's defense system.

Other programs green with ENVY

At the heart of OTI's Smalltalk development tools is ENVY, an environment similar to IBM's Visual Age. (Which is hardly surprising, since Visual Age is based on technology licensed from OTI.) ENVY enables a team of programmers to work simultaneously on a project, sharing code and classes from a central repository. The virtual machine architecture of Smalltalk, meanwhile, allows team members to write and execute code on any platform supported by ENVY (a variety of Unix variants, QNX, OS/2, and Microsoft environments), and code written on one platform can be read from the central repository and executed without modification on any other platform, or even the embedded target.

Unlike a conventional file-based code control system, ENVY revolves around an embedded database. ENVY's ownership model means that while all the developers can see and modify code, only the original owner can release that code into a lineup or product. So, while other developers can experiment, these experiments are prevented from finding their way into official code releases and thus affecting the integrity of the project as a whole.

Versioning of classes, vital to successful project management, is supported by ENVY. Programmers are able to browse through source code for differences between versions of a class, and load different versions dynamically to explore the impact of changes. Clohessy explains that the complexity of software and ever-changing specifications make it next-to-impossible to write software right the first time, so an incremental approach is needed in most cases. Object-based coding systems are the most efficient way to meet these demands.

This was shown clearly in a project that was developing software for an exhaust emissions analyzer. The US Environmental Protection Agency, which sets a federal standard for auto exhaust emissions, had announced its intention to allow each individual state to set its own standards -- meaning that up to 50 versions of the software might have to be produced. Over 11 programmer-years were spent on the project using C++ before it was abandoned. When the project was restarted from scratch with Smalltalk, it was completed in just 6 programmer-months, due in large part to the class revision control capabilities that allowed a tight rein to be kept on the different versions of the code.

Thanks to the Unicode foundation of the ENVY environment, Japanese and other double-byte character sets are supported. In addition, GUI classes can dynamically allocate screen real estate for UI (user interface) widgets whose sizes vary for different (human) language versions.

Living down its reputation

Although Smalltalk has long been recognized as a fast development environment, it suffers from two common misperceptions: that it is a personal (rather than team-based) programming environment, and that its interpreted bytecode nature makes it slow. Previous implementations of Smalltalk were not team-based, admittedly; but, as explained earlier, the ENVY environment turns Smalltalk into a true team tool.

The question of speed is being dealt with in two major ways. First, OTI has launched a significant effort to make its virtual machines as efficient as possible. (In a test of efficiency, when OTI converted some Java bytecode for an OTI virtual machine, the Java applets ran 5 times faster than on a Sun virtual machine. Future versions of ENVY will support Java development, and there may soon be a Netscape plug-in that allows the downloading and execution of Smalltalk applets.)

Second, the ENVY environment supports "bare-metal" C routines that can be messaged from within Smalltalk code, and vice versa. Clohessy claims that only 10% of a typical application is speed-critical, and these speed-critical parts are the only ones that need to be written in C (or assembler). For the programmer, these parts can usually be prototyped in Smalltalk and later converted to C if it appears necessary. This capability at the prototype stage adds reliability to the final product.

Clohessy feels that Smalltalk stands unfairly accused, based on criticisms that were applicable five years ago. But Smalltalk has changed dramatically. "If we were a brand-new language like Java," he laments, "we wouldn't have this problem [of public perception]."

So, before you rush out and write your next Java application, take a moment to consider instead using an object-oriented environment that offers a mature class library paradigm, multi-platform support, and sophisticated garbage collection, together with a team-based development environment and code control. And if you're in the business of writing software for "computers that aren't computers," and don't relish the thought of debugging your way through pages of assembler-generated hex dumps, ENVY Smalltalk might just be the answer.

For more information about Smalltalk and Object Technology International, visit OTI's webpage at http://www.oti.com. While there, be sure to check out Jeff McAffer's Smalltalk Links page, http://www.oti.com/jeffspg/smaltalk.htm.