Friday, May 04, 2007

In-process cross-language object interaction: adapters or navigators?

There's a new article on my website titled "In-process cross-language object interaction: adapters or navigators?".

I'm discussing two typical approaches for object interaction between a "higher level runtime" (HLR - i.e. a scripting language runtime) and "lower level runtime" (LLR - runtime for whatever language the high-level runtime is implemented in, i.e. JVM or CLR, or even straight C).

The two approaches discussed are the somewhat more common "adapter" pattern, and the somewhat less common "navigator" pattern.

HLR implementations usually go for the adapter approach, but I argue that the navigator approach is superior to it, especially when you want to extend the object interaction from the HLR-LLR dimension (i.e. representing native Java objects in a JavaScript runtime written in Java) to an orthogonal dimension, namely have interoperability between two distinct HLRs running on the same LLR in a decently intuitive manner, without knowing of one another in advance (i.e. use objects created in JRuby from within Jython, without Jython knowing about JRuby at all).

This level of interoperability opens up new possibilities for people implementing software systems, as they become free to implement different subsystems in languages that fit the job most.

Discussion welcome in comments.

1 comment:

Thorbiörn Fritzon said...

Great stuff!

Really, interesting read, actually. I've been hard at work trying to figure out a good way of doing the adapter approach the last couple of week, and pretty much ended up with the same list of problems you have. Since I have a birthday (my mom's 60th) coming up I will have a quiet day to try out your Navigator/MOP approach.