Sunday, May 17, 2009

A whirlwind tour

I've been on a bit of a tour of late.

I've tried out JetBrain's MPS system, attempting to use it for code generation for work, and I couldn't get it to do what I needed it to. In a lot of ways, the experience reminded me of attempting to use ANTLR's AST treegen approach - I was frustrated by a lack of debugging support.

I am having more success with using ANTLR to parse an input file, in this case a Java interface, to my own Java AST classes, and then generating code using StringTemplate. My first bash at this approach mushed the input AST and the output AST into one set of classes, and that was kinda messy. Next time I'm going to separate the concerns of the input AST and the output AST required by StringTemplate. I'm thinking I'll attempt to build the output AST as an adapter over the input AST, instead of having a AST modification pass. I'll find out how that goes in the coming week.

I'm also playing with Terracotta, the network attached memory store for the JVM. The one downside of Terracotta is that it exposes something that is often hidden - Java's classloaders. In java, a classes' identity not only includes it's bytecode, but also which classloader it was loaded by. As Terracotta is all about storing java objects while maintaining their identity, this means that classloaders become important. Now, given I am attempting to marshall classes between tomcat instances an Mule instances, I am having to subvert the classloaders of both. Not fun. Not fun at all.

The one thing that is becoming stupidly obvious about now is that the future of computing is about scaling sideways. Terracotta is an attempt to bring this to the Java world, but it feels like a bolt on. It breaks so many assumptions that Java programmers have. It makes thread programming with locks important, and honestly lock based concurrency is a bitch to get right.

One approach is to do Clojure + Terracotta. Another is to go back to Erlang. Interesting times.

Comments from Buzz

0 comments:

Post a Comment