Tag Archives: java

Closures in Java 7 (Dolphin)

It has been nearly two years since the release of Java 6, so it is time to review the new and refreshing features of its successor, Java 7 (a.k.a. Dolphin) which will be released on 2009.

BGGA is one of the most exciting proposals and it seems to be almost done. BGGA gives to Java lambda closures, so Java will looks like functional language.

Since November 2007, C# has had similar characteristics, and it is hard to find a developer who dislikes those new features, but it is, even nowadays, easy to find developers who ignore it.

I thought that we would get the same in the Java community. I was wrong. A lot of them just think that those kind of modifications will come with an army, which will destroy every sign of smartness. The argue? They thought that if the same project is developed by a bunch of developers and the half of them use the imperative way and the other half the functional way, it will be a mess.

I do not think so. Java is, right now,  powerful enough to allows us to write code in many different ways, and no one think that it is a mess. Would you be frightened if some developers would use “if else” and others would use the ternary operator? Oh my Lord! The sky will fall down on our heads!

If you develop in x language, you must know its functions. You are not obliged  to use every single feature, but you must understand everything.

When I write C# code, I always try to use the functional way, because I strongly believe that it is better to express what you want, instead of saying how you want it also. By omitting that part you are avoiding errors, and, by the way, getting the code more legible (which is always good).

To sum up, for those who say that the java community can’t take a step forward because some developers will not have enough time to learn the new features, please, look for a better excuse.