martes, 1 de junio de 2010

Is Java dying? Dependency injection and other Java necessary evils

My friend Jorge Manrubia have published a very interesting post about the necessary evils in Java

This post helps me to thing about this: Is Java as alanguage dying?

I agree with Jorge, a huge movement from Java to dynamic typing languages has started (including here in Spain), and this is normal as Java is a 15 years old language, the new languages are combining dynamic typing, metaprograming and another awesome features and (very important) the JVM/J2EE platform is executing these languages.

I also believe Java is not dead at all, the strong typing has its advantages and with hard work people have achieved some of the goals he is talking about.

Dependency injection is a language agnostic concept that was implemented first with a container (Spring has almost six years, Plexus or Avalon even more), then in a lighter way (Guice) and also without a container in Spring ROO, but yes, it's a natural feature via metaprogramming in Ruby and other languages.

I would like to test Spring Roo in a real environment, because it lets you do something that years ago I found impossible in Java platform, Domain Driven development that in the end translates the concepts to classes, I mean, real object oriented programming and no anemic classes and a lot of procedural artifacts (managers, daos,...) Spring Roo achieves this with a massive use of Aspect J (not java at all).

The question is, is it enough using this kind of tools in Java, or is better migrate to Ruby/Groovy/Scala? And I don't think is an easy question, maybe it depends on the developer profile and experience, but it's very important to know these tools do exist and there are patterns and practices that are global to all languages.

About Strong Typing, I would change the GWT examples by others. Not because I do like this technology, but because GWT is not really Java, it has the Java syntax but is a tool that compiles Java to JavaScript, and uses a series of tricks (like JSNI) to communicate the original Java (then Javascript) code with the native one. In this case, the GWT advantages have got a syntactic overhead when you want to use native Javascript (usually to do REST) in your code.

Actually GWT could be a good example of the advantages of strong typing. It would be awesome if the Google guys have built a tool that let you write Ruby, Groovy, Scala and compile it to JavaScript, but probably this is not possible without the Strong Typing stuff.

And about Object disorientation, I haven't nothing to say, when Java drives you to this type of non-oriented programing, it sucks!


Update [June 29, 2010] Thanks Tako for the grammatical corrections!

1 comentario:

Unknown dijo...

The same happened to me Juanfri, I started writing a response here but in the it just grew too large and I decided to write my own article hehe

http://code-jive.blogspot.com/2010/06/is-java-dying-response.html