Tuesday, April 29, 2008


JavaConnect := Java asSmalltalkValue

Nice project: JavaConnect is a Visualworks Smalltalk library that allows a seamless interaction between Smalltalk and Java. A Smalltalk application can access any Java object and send messages to it, just as if it were a Smalltalk object.

Read more at the JavaConnect project page:

Would be interesting to know how this relates to Joachim Geidels JNIPort project.

Hi Torsten,

JNIPort for VisualWorks (now at http://jniport.wikispaces.com/) and JavaConnect were more or less developed in parallel. Both were presented at last year's ESUG conference. Johan Brichau and I were discussing a possible merger of the two projects, but have not come to a conclusion yet.

There are some differences:

- JNIPort was developed by Chris Uppal for Dolphin Smalltalk and later ported by me to VisualWorks. Currently lacking support for VisualWorks namespaces, it does not (yet) allow one to reference a Java class by simply writing its name into a Smalltalk method. JavaConnect allows this, but in a way which would make porting to another Smalltalk dialect difficult IMO. For JNIPort, I am working on a different implementation which would be an add-on for VisualWorks, and thus allow a direct port to other Smalltalk dialects.

- A consequence of the lacking support for Namespaces is that JNIPort does not (yet) show Java classes in the Refactoring Browser as JavaConnect does. It does show predefined Smalltalk wrapper classes for Java classes, which can be generated when you want to extend a Java class by Smalltalk methods. JavaConnect can show the dynamically generated wrapper classes in the Refactoring Browser, while JNIPort comes with a separate (and currently quite simple) browser for those classes.

- The mechanisms for extending Java classes by Smalltalk methods are different.

- JNIPort's design allows connecting to more than one Java VM concurrently. However, Sun's Java VMs and maybe others do not support this, and I have not yet found a convincing use case for this feature. JavaConnect is restricted to a single Java VM. But as I said, that's probably not really relevant.

- JNIPort already supports callbacks from Java to Smalltalk. This feature is announced for the next release of JavaConnnect, too.

- Earlier versions of JavaConnect had some restrictions concerning thread safety, while I consider JNIPort thread safe. I have not yet looked at the latest version of JavaConnect, so this may no longer be true.

Apart from this, there are not many differences from a programmer's point of view. From what I have read about the latest version of JavaConnect, the feature lists of both frameworks seem to be very similar. Personally, I prefer JNIPort because of its potential to be ported to Squeak and VA Smalltalk, but I my opinion is of course biased. ;-)

Joachim Geidel
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?