Crossing the Language Boundary

The last few months have been interesting. I've started a new job building the web site of Boomer.com. Part of this process has been reacclimating myself to Java. My language of preference is Perl and I'm still working on a few projects at home involving Perl. In the last week, we've made some decisions in which it appears as if we'll be using PHP here for some of our development as well. From these experiences, I've found that Java actually cooperates pretty nicely with these two scripting languages.

In Perl, I've written a library to connect with a Java library I'm using at work, named Java::JCR. Rather than porting an implementation of the JCR to Perl, I've actually hooked the JCR libraries from Perl. Using a tool named Inline::Java, the Perl interpreter spawns a JVM to run the Java code and then communicates with that JVM to run the necessary code. This actually works very well. After getting past the first few hurdles of getting the interface built, date conversions handled, and exception handling worked out, a user of the Java::JCR library can use a JCR implementation without worrying about any of the nuts and bolts of the interface. I'm very happy with the Perl-to-Java interface here.

In PHP, we're looking into using Drupal to make up for some of the deficiencies in our web site design, particularly in the area of community collaboration. However, we're using a JCR-based ECM, Magnolia, to handle a lot of the document and publication management. We need communication between the collaboration side and the publication side of the web site. Much of that communication can be handled through the use of RSS and other syndication protocols or through the use of RPC. However, since both of these involve serialization of data across a network connection, they can slow things down. Some features (particularly search, in our case), don't work very well this way. Therefore, we're looking at the PHP JavaBridge or Caucho Resin and Quercus to perform direct language communication between PHP and Java.

From my experience thus far, Java actually does a pretty decent job of communicating with other languages—either by RPC or even directly with inter-language communications. This involves some overhead of running both an interpreter/VM for the second language in addition to at least one JVM, but it seems to work pretty. I don't know that I can really extrapolate out to other languages in general, but from my experience and research so far, PHP and Perl both seem to work very well with Java. Since each language has it's own pros and cons, this allows me to consume pros from multiple languages while avoiding a few more of the cons.

Anyway, this has been a cool enough experience that I thought I'd share it.

Cheers.

0 TrackBacks

Listed below are links to blogs that reference this entry: Crossing the Language Boundary.

TrackBack URL for this entry: http://contentment.org/mt/mt-tb.cgi/293

Leave a comment

About this Entry

This page contains a single entry by Andrew Sterling Hanenkamp published on June 22, 2006 6:32 AM.

Hawking doesn't think ahead was the previous entry in this blog.

Another Not Quite Right Solution is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.