Skip to main content

Won't Get Fooled Again

Posted by editor on July 25, 2005 at 9:00 AM PDT

Keeping an eye on Java's future

Today, I'm going to blog about an interesting discussion on Generics in the forums, though it will take me a bit to get to the item we featured on the front page.

Part of the problem is that I couldn't reproduce the post that started the thread, as the publishing system kept trying to turn the generic angle-brace markers (e.g., List<E>) into parsed angle braces -- i.e., it saw them as tags. So let me quote some of alexanderschunk's original post:

This is a general thread on the new Java Generics feature as it was introduced in Tiger and implemented in Mustang.

I post this because i come from a C++ background where Generics - or Templates - were introduced in order to be able to write one class template or method template that could be used for any types of objects of type T.

However, the Generics approach in C++ was - no matter how powerful it was - it did not lead programmers to write more readable or simpler code rather than more complicated and confusing code. I know this from experience ;=)

After an example from the JDK source, he continues:

This kind of code is neither easy to read nor easy to understand - what kind of object/class is T and why does it need to extend Enum<T>.

The use of T o or Enum<E o> indicating that T may be of any kind of Object is straightforward and may be a good add-value to OOP programming but it should be constrained to that.

If you start applying things like polymorphism to Generics - <T extends Enum<E>> - things are getting complicated.

In fact i do not see a benefit to use Generics at all and they do not make Java programming any easier. I would love to see that Java keeps on going the Kiss way.

The discussion continues on the merits of Generics, but there's a very good comment that mthornton makes:

Generics didn't appear in Java overnight. JSR 14 was many years in progress, with any number of opportunities for the community to comment on the proposals. Yet vocal opposition was rarely heard until the final months of the JDK 5 beta and after final release.

Like or hate Generics, you have to admit that he's very right on this point. The Add Generic Types to the Java Language JSR started way back in 1999, and if you google for java generics and a year, you can find plenty of evidence that information about Generics was well-disseminated long in advance: here's an ONJava introduction to Generics from 2001.

So, what's happening now in Java that you should be aware of? Well, the plans for J2EE 5.0 and Java SE 6.0 were presented at JavaOne and are readily available in many forms: JavaOne slides, the JCP, java.net blogs that spell out the major pieces of Mustang, or, for that matter, the Mustang source-drops on java.net.

You don't have to like every change that comes with the next version of Java, but if you get involved now, you have the opportunity to make it better. At the very least, if you take a look now, you won't be surprised later.


Continuing the discussion in today's Forums,
mcnepp has this to say Re: Java Generics and the Kiss principle:
"I wholeheartedly agree: Introducing Generics without proper runtime support was probably the biggest single mistake in the history of Java. This hurts all the more because all the other features introduced with Java 5 (annotations, enhanced for, enums, covariant return types, variable argument lists) are huge improvements, each of them easy to use and without negative side-effects on other aspects of the language. So developers are facing the tough decision of either not using any of the new features or being flooded by warnings due to a half-baked generics implementation."

chris_e_brown has questions on Subpixel anti-aliasing: enable it programmatically for Swing components:
"Having read Phil's Font Fixes ...and having downloaded Mustang b44, browsed the source, and read through the JavaDocs, I can't see how to enable subpixel anti-aliasing when it's not "inherited" from the desktop. I'm using Windows 2000, and am trying to create a simple "Hello World" JFrame with a few JLabels and JButtons to try this feature out. I can see how text should be rendered on a surface such as a JPanel by overriding paintComponent() and the Graphics2D object, but I can't see how to force other components (labels, buttons, tables, and so on) to use this "


In this week's Spotlight:
"The Mobicents project offers the first open-source certified implementation of JAIN SLEE 1.0, which "brings to telecom application developers what J2EE brings to Web and Enterprise application developers." JAIN SLEE allows popular building blocks such as SIP to be plugged into a framework as resource adapters. It also enables the composition of Service Building Blocks (SBB's) for call control, billing, administration and more. Mobicents is also applicable to problem domains requiring high volume, low latency signalling, including financial trading and online gaming."


In today's Weblogs, Tim Boudreau discusses
Why I'm Proud of the NetBeans Community Awards:
"A couple weeks ago, at NetBeans Day in San Francisco, we gave out awards for outstanding contribution to the community. The winners got a framed Duke poster...and a really nice workstation... "

John Reynolds wonders about Faces and Flash:
"I came across an announcement for IBM's Faces for Laszlo this morning. I haven't had time to delve into the details, but my impression is that they're "filling in" some of the missing Rich Internet Application pieces that I've wanted for a long time."

John O'Conner announces a Programmer's Retirement:
"Every profession has its share of workers who continue past their prime years of productivity. Maybe you've seen one...the overweight police officer who looks more at home in a Crispy Creme shop than in his cruiser. I'm thinking software engineers have to 'throw in the towel' sometime before 40...before the ol' brain loses too many working cells."


In Also in
Java Today
,

"Have you ever wondered why there are six types of Transaction demarcation attributes (NotSupported, Required, Supports, RequiresNew, Mandatory, and Never) supported in beans using container-managed transactions (CMT), but if you're using bean-managed transactions (BMT), the only functionality the EJB spec provides is to begin and commit/roll back transactions via the UserTransaction interface?" This question concerned Dmitri Maximovich, since it meant that BMT beans couldn't suspend and resume transactions. Or can they? In Bean-Managed Transaction Suspension in J2EE, he shows how different J2EE servers expose the Java Transaction API's TransactionManager, which offers suspend and resume functionality to your EJB's.

Many developers need to capture transaction times for high-volume transactional systems, but have avoided using Java's System.currentTimeMillis() due to rumors of poor performance. In Bring Java's System.currentTimeMillis() Back into the Fold for Transaction Monitoring Javid Jamae shows why currentTimeMillis() has gotten a bad rap.


In Projects and
Communities
,
the Portlets Community home page is hosting an online excerpt (PDF, 828 KB) from the book Building Portals with the Java Portlet API by Jeff Linwood and Dave Minter, including complete chapters introducing the portlet API, portlet life cycles, and portlet packaging and deployment descriptors.

Bruce Boyes' weblog entry Real Soon Now: mesh network standards reports on the mesh network standardization process, which will allow "practical distributed control and communication applications utilizing standardized wireless communications."


In today's java.net
News Headlines
:

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net News Page using our
news submission
form
. All submissions go through an editorial review before being
posted to the site. You can also subscribe to the href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
feed.


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e"> events submission form.
All submissions go through an editorial review before being posted to the
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.

Keeping an eye on Java's future