Broken Hearts Are For...
Buyer's remorse for Generics and Autoboxing?
We knew Generics were coming. There was an implementation of it that could be used with Java 1.4, during the long wait for the J2SE 5 betas and ultimately its final version. So, really, just now people are starting to say that it was a bad idea?
What happened? Did the silent majority get this one wrong? I remember five years ago when it was the most popular item on the bug parade, I didn't really think much of it. I thought that if there really is a critical problem in getting untyped objects from Collections, that to be completely honest, I was far more likely to just do an
instanceof on stuff I pulled from the Collection, or to just catch the
ClassCastException and live with it, rather than learning a completely new syntax to avoid the problem. 99 times out of 100, my code was the only one populating the Collection, so the chances of getting an unexpected type of object out of the Collection was zero.
So I voted all my bug votes for Java Media Framework stuff that never got looked at. That and the un-deprecation of
ServletRequest.getParameter()... bonus points for anyone who sees how that relates to generics, but I digress.
Anyways, maybe there were people with principled objections to Generics, but it seems more people just shrugged and said "yeah, whatever" and plugged away with our work. Generics arrived and suddenly everyone realizes that they're probably more trouble than they're worth. Bruce Tate, in Beyond Java, even sees them as typical of what he believes are Java pathologies:
Java 5 is strongly touted as perhaps the most innovative major release of Java in half a decade. I do agree that it's going to have a significant impact. I'm not at all convinced that all of the impact will be positive. I regularly attend a conference called NoFluffJustStuff. The experts at the conference sit on a panel and answer questions. One of my favorite questions deals with new features in the language. The whole panel agrees that generics, as implemented, are a bad idea. That usually shocks the audience.
If you think about it, the Java generics Java Specification Request (JSR) introduces a whole lot of syntax to solve a marginal problem with no corresponding change to the Java virtual machine (JVM). I'm guessing that the typical Java developer rarely gets a class cast exception. And there are plenty of opportunities. Most of the objects in a typical Java application are usually in collections anyway. Whenever you take them out of the collection, you've got to cast them from Object anyway. At that point, type safety gives you about as much protection as a lap belt in a burning, plummeting 747. Yet, the generics syntax is invasive, and the implementation is worse. In an age when more and more experts assert that dynamic typing leads to simpler applications and productive programmers, Java developers are learning how to build stronger enforcement for static types.
I'm bringing this up because it's come up in multiple discussions in the forums. The thread Comparison operators by value kicks off with ideas about how to resolve some problems with
== introduced by autoboxing. The thread moves on to consider whether Autoboxing as a whole is a mistake, and then brings in Generics as a fellow poster child for well-meaning features gone wrong. User
No matter the conservative approach (which is the correct one for production) is to not change unless there is a compelling reason and the change will do no harm. I'm sorry but from where I stand, Generics do not meet that bar and autoboxing falls way below it. To be fair, I've seen cases where they can help but these are really use a few edge cases. I don't think the main core language should be designed by exception. n'uff said on this subject!
'nuff said? Do you think features like autoboxing and Generics are misguided? Has Java gone off the rails? Please join in the forum discussions and let us know what you think.
Also in today's Forums,
rickcarson speaks up for the advantages of Java's openness as part of the feature discussion in
Re: Need help with research for graduate class:
"I think that if features do not work as documented they should not be included. This was one of the nice things about Java in the early days, and part of the reason why I jumped ship away from the M$FT offerings. In VB or the win32api if something doesn't work as advertised you have two choices: either the frustration of fiddling with it till it works (hello blue screen! hope you saved recently!), or giving up and telling the client it can't be done. A classic example was the ASP Dictionary object, which spat back random garbage, even with only a couple of items in it. Whereas with Java you can look under the hood to see what is happening."
Hans Muller has surprising news in today's Weblogs. In
Official: Swing is the Dominant GUI Toolkit, he writes:
"The most recent Evans Data Corporation developer survey had this to about Swing: 'Java Swing with 47% use, has surpassed WinForms as the dominant GUI development toolkit'. We are number one!"
Daniel Brookshier has
An interview with Brian Koontz, creator of the Open Source Technology program at North Lake College:
"Open Source for college credit? Yes, it's true! Daniel interviews Brian Koontz, Computer Science program coordinator and OSS zealot at North Lake College. Brian created a certificate program for Open Source Technology at North Lake College in Texas. Daniel Brookshier interviews Brian about the certificate and the open source impact of open source."
Finally, Chet Haase lightens things up with some Swing humor in Two Items Walk into a ToolBar...
Bruce Tate and Justin Gehtland are back with updated content from
Spring: A Developer's Notebook. In What Is Spring, Part 2, they show
how to use Spring's Web MVC framework to build a web GUI for a simple bike
shop example. This article is excerpted from the updated, current version
of the book, which corrects errors from the earliest printings.
Robin Miller goes against some currently popular thinking in the NewsForge article Three reasons why Internet-based applications are a bad idea: "We've all heard the hype about how Sun and Google may someday, somehow, produce a version of StarOffice or OpenOffice.org that you'll access online through your browser instead of installing an office suite on your hard drive. Even though I think 'The Network is the Computer' makes a fine marketing slogan, I am still going to keep most of my software where it belongs: on my own computer. Here are three reasons why."
In Projects and
the Robotics Community's Terminology project hopes to clear up misused and overloaded terminology in the field of robotics by collecting terms and historical data, defining terms accurately, and presenting recommended modern-day usage. The results of the project will be made available under a Creative Commons license
The JAX-WSA project hosts the reference implementation for JSR 261, Java APIs for XML Web Services Addressing, which defines APIs and a framework to support transport-neutral addressing of Web services. The project hosts the early draft of the spec, javadocs, and a weekly build of the reference implementation.
In today's java.net
News Headlines :
- Yan Container -
- Jofti 1.0 Cache
Indexing and Search
- Jimm 0.4.1
- Database Bean
- Crispy 0.6.1 -
Registered users can submit news items for the
href="http://today.java.net/today/news/">java.net News Page using our
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
Current and upcoming Java
- October 16-20, 2005 - OOPSLA 2005
- October 19-20, 2005 - 9th Jini Community Meeting
- October 21-23, 2005 - Greater Atlanta Software Symposium
- October 25, 2005 - Detroit JUG Presentation: Object-Oriented Design: From Principles to Patterns
- October 28-30, 2005 - Northern Virginia Software Symposium
- November 1-4, 2005 - Enterprise Java Architecture Workshop: San Francisco
- November 4-6, 2005 - Lone Star Software Symposium 2005: Dallas Edition
- November 8-10, 2005 - JavaOne Tokyo 2005
- November 11-13, 2005 - Rocky Mountain Software Symposium 2005: Fall Edition
- December 7-10, 2005 - The Spring Experience 2005
- December 10-11, 2005 - Weekend With Experts
- December 10-14, 2005 - ApacheCon 2005
- December 12-16, 2005 - JavaPolis 2005
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
Archives and Subscriptions: This blog is delivered weekdays as
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.
Buyer's remorse for Generics and Autoboxing?