Pure Danger Tech


navigation
home

Is LINQ leaving Java in the dust?

31 Jan 2008

Interesting story today asking whether LINQ has given .NET an edge over Java. LINQ is best-known as a way to embed SQL-like statements directly in code. However, it’s really a much deeper technology that allows you effectively build DSL-like constructs in libraries that work as if they are part of the language. And that is undeniably powerful.

From what I’ve seen, the C# code using LINQ also seems to be relatively readable (due to the DSL-like nature of it) and that is a big win from both the power and complexity standpoints.

So, then we have the question of Java, which does not (currently) have the ability to weave structures into the language as elegantly as LINQ. I think the closures work could make that possible in Java 7, but we’re talking probably 2010 before Java 7 is in common use.

From a language feature perspective, C# and LINQ are evolving faster and adding more important features than Java.

We have to take a step back though and consider some other things. C#/.NET are not driven by standards or a loose coalition of competing/cooperative companies; they’re driven solely by Microsoft. And Microsoft is happy to break backwards compatibility and force platform upgrades as the sole provider of the technology. Things are a bit more bohemian in the Java world and the JCP may be the tortoise to Microsoft’s hare in this regard.

But I wouldn’t count Java out.

The addition of annotations, static imports, and generics (even crippled generics) has opened some interesting opportunities and I think we’ve only recently started to see people target and push those features to their fullest. I suppose the poster-child for this in the context of LINQ must be Quaere, which aims to do much the same as LINQ by building an internal DSL. Guice is another good example of pushing these features to their limit.

You might also point to the possibility of dropping into Groovy and using builders or other DSL-friendly tools there. Or moving slightly farther afield, use JRuby or Scala to develop the data access parts where you need more flexibility.

Between a quickly-evolving .NET with a limited community vs a more slowly-evolving Java with a rich community, gimme the Java world any day.

But, I’d like to hear what you think. Are C#/.NET innovations changing your mind? Are they just a call for improvement in the Java world? What can we learn from each other?

Originally posted on java.dzone – go there for comments.