Friday, December 19, 2008

Most-Missed Java SE 7 Features

I have blogged before about some of the interesting observations from previous Java.net polls. While these polls are in no way scientific and very little seems to be done to keep someone from stuffing the ballot, the fact that the results often correlate closely with my experiences and anecdotal observations leads to me believe they are generally fairly representative of the Java community's perceptions and opinions. With this in mind, the current results of the Java.net poll question Which of these excluded-from-Java-7 features were you most interested in? provides interesting insight into what matters most to each of us. I say this because it is my not-so-deep (read "obvious") theory that the feature an individual developer most wants in an upcoming version of Java is always closely related to what they miss the most in their daily tasks.


Closures

As of this writing, there are just over 160 votes (but new votes are coming in fairly rapidly right now) and the far-and-away leader for most missed dropped feature from Java SE 7 is closures. At this point, the closures feature has received relatively close to half of the total votes. In one respect, this is to be expected. Closures have seemed to dominate the Java SE 7 discussions until it was announced that they would not be included in Java SE 7. However, some of the reason for this significant discussion is the controversy surrounding both the concept of having closures at all as well as how closures would be implemented.

While closures have been one of the most hotly discussed proposals for Java SE 7, I have personally been fairly ambivalent about them. I can see how they would occasionally be useful in my work, but I can live without them for the most part. In other words, I wouldn't mind if they were added, but it did not really bother me when I heard that they would not be included in Java SE 7. However, if we are to believe the results of this poll so far, close to one half of Java developers wanted this feature the most. This is in line with a previous Java.net poll question regarding developers wanting the closures question resolved in time for Java SE 7.


Properties

The second most missed feature as of right now is first-class properties with just under 15% of the votes. This is clearly a distant second to closures. Like closures, this is another addition to Java that I have mixed feelings about. I strive to follow Joshua Bloch's advice to minimize mutability and Allen Holub's advice (Holub on Patterns) on being careful with get/set methods in my objects. I therefore prefer not to have "set" or mutator methods unless required. I find the idea of using my IDE to automatically generating get/set methods for any and every class that I write to be distasteful. However, there are some types of objects, such as data objects, that are intended for uses that involve many get/set methods. For these limited situations, the first-class properties would provide some desirable benefits. In the end, my leanings in favor of and my leanings against Java properties made it difficult for me to be too excited about the prospect of them or too disappointed when it was announced they would not be part of Java SE 7.


Reified Generics

The current third most interesting feature dropped from Java SE 7 is one I did really want -- reified generics. I don't think I'm capable of counting all the times that I could have used generics support at runtime. I have enjoyed many benefits of using generics, but am greedy and would like to enjoy even more benefits from generics by gaining runtime benefits to complement the current compile-time benefits. While "reified generics" currently has just under 12% of the votes, it certainly is one of the features I am most disappointed to see not included in Java SE 7.


Beans Binding

Fourth place in the poll on most interesting features dropped from Java SE 7 consists of a tie between another of the features that most interests me (beans binding) and "none of the above" (worded differently in the actual poll). Each currently has just under ten percent of the votes. My work with Flex and OpenLaszlo over the past two years has led me to greatly appreciate the productivity gains associated with solid beans or property binding implementations. I really wanted to see this added to Java with Java SE 7 and this is what I voted for on this poll. There are Java alternatives such as JGoodies Binding and the JSR 295 Reference Implementation, but it would have been nice to have this as a standard part of the Java language.


None of the Above

It was interesting to observe that almost ten percent of respondents don't miss any of the listed features dropped from Java SE 7. A natural question is how many of these are against most/all new features/changes to Java and how many just have a different feature or set of features they care about. An example of a feature that may still not make it into Java SE 7 that I think many of us really do care about is the new date/time API (JSR 310). I have blogged previously on my interest in the JMX 2 and JMX Web Services Connector being part of Java SE 7 as well.


Operator Overloading and BigDecimal Syntax

The two currently least interesting dropped Java SE 7 features are the somewhat related items of BigDecimal syntax and operator overloading. Like closures and first-class, properties, I am somewhat ambivalent on these. I could see some use for both, but am not too concerned about them not being added to Java SE 7.


Conclusion

There are obviously many factors that influence which features each of us most wants to see in a new version of Java. These factors include favoring features that reduce the things that cause us the most pain on a regular basis. Another factor impacting which features we desire most or are most against is our individual preference for or aversion to a particular design/implementation ideology. Finally, we are all influenced by syntax and characteristics of other languages that we use. I mentioned the data binding in Flex and OpenLaszlo influencing my desire to see a similar feature in Java. Similarly, advocates of closures and first-class properties cite such behaviors in other languages.


Additional Resources

For additional coverage of Java SE 7 coming features and dropped features, I don't think there is a better resource than Alex Miller's Pure Danger Tech blog. The Java SE 7 section of this blog is most pertinent to Java SE 7, though I laughed out loud at some of the "possibly true reviews" of the book The Definitive Guide to Terracotta.

Other good Java SE 7 resources include Danny Coward's Sun Weblog (particularly Java SE 7 section), Stephen Colebourne's Weblog (particularly the Devoxx-related blog posts), and Mark Reinhold's blog.

3 comments:

Alex Miller said...

I maintain a link blog at http://java7.tumblr.com if you're interested in seeing an ongoing stream of Java 7 links.

Unknown said...

I don't understand the guys who are opposed to properties and closures. With those archaic minded people I don't see any future for java. What is wrong with having alternative techniques for writing programs. If you don't want to use closures or properties you won't use it or force your programmers not to use it. It is that easy.

hitesh kumar said...

Features of Java

The main features of java is; it is platform independent and secure.