Departments


Editor's Forum


As I mentioned briefly in last month's Editor's Forum, I am writing a Java to C translator. The job should have been done by now, like your typical software project. I attribute the overrun to a late start, however, not bad estimation. At least so far.

In any event, I've had to start talking about the product before it's finished. (See, for example, my column in our sister publication, "State of the Art: Translating Java to C," Embedded Systems Programming, May 1997.) That demands a certain conservatism, at least in my book. I hate to promise things and later find that I can't deliver.

One area where it pays to be conservative with Java is performance. The language has so far evolved in the Smalltalk tradition — it is interpretively executed and it puts a premium on portability. That heritage colors the language in a variety of small ways, and slows it down. In designing the language, Gosling and company have allowed features to creep in that practically require an interpreter. Other features have overheads that are unimportant in an interpreted environment, but really stand out in compiled code.

A major concern, for example, is garbage collection. Java lacks the clear determinism of C++ when it comes to destroying objects that go out of scope. A typical implementation doesn't really try to reclaim storage as it gets liberated. It can build up a considerable debt before it sets out to reclaim orphaned storage. As a result, a Java program can be subject to long dead spells, while garbage collection occurs, spells that can be difficult to bound in time. An interactive program suffers annoying delays; an embedded program with hard real-time constraints may find the delays unacceptable.

I'm not yet ready to promise a winning solution to the problem of garbage collection, but I'm making good progress on this front. On other fronts, I've already done better than my fondest hopes when I started this project. And I'm convinced that Java makes eminent sense as a compiled language, in a whole host of application domains. It ain't just for writing cute Web applets that make your screen twitch.

My first reaction to Java, nearly a year ago, was that it is an "interesting little language." (See my Editor's Forum, CUJ, August 1996.) I feel that way more than ever. And I'm really looking forward to customer feedback. I think others will agree, once they give compiled Java a try.

P.J. Plauger
pjp@plauger.com
http://www.tiac.net/users/pjp
http://www.dinkumware.com