Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java Closures Death Match

DZone's Guide to

Java Closures Death Match

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

With the recent surge in Java closures blogs, I thought I would do a roundup on some recent hot topics. Probably the most important development is that we now have prototypes for the three major closures proposals. That means it's time for the steel cage death match!

Ok, I guess that's not really necessary. But we do have the tools now to do a comparison on syntax and functionality of these proposals:

  • BGGA (spec) - Neal Gafter is driving the most thorough proposal
  • FCM (spec) - Stephen Colebourne and Stefan Schulz have a method-oriented approach
  • CICE (spec) - Josh Bloch is championing a simpler approach to simplifying anonymous inner class syntax

java.net has been running a poll on closures and the results are kind of interesting. At the moment, BGGA is in the lead, but neck and neck with NO closures. FCM is making a respectable showing (given it's lower profile) and CICE has only a tiny percentage. I suspect this poll probably isn't too useful since the vast majority of those voting have not taken an in-depth look at the proposals and really understood the details and differences. Peter Ahé (former tech lead for javac), requested a boycott of the poll in principle.

Another area of focus lately has been on the closure syntax, which of course is something that will look foreign to any Java developer unfamiliar with closures. Here are some recent syntax articles:

I can't say I'm too excited about the pointer syntax idea. I find FCM's syntax to be a little nicer in general although I don't like the placement and notation of return types. I initially disliked BGGA's syntax, but I've seen enough of it now that it doesn't bother me. I think the final blog there is an interesting one and it would be convenient to use the same syntax in Groovy and Java.

If you're interesting in tracking articles on closures and Java 7 in particular, check out my Java 7 link blog (RSS).

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}