2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


Unleashing Tiger
Unleashing Tiger

Up till now, changes to Java have been pretty much constrained to APIs and the inner workings of the Java 2 platform. All of this will change once the JDK 1.5 has been released. The extent of these changes was revealed in a recent interview with Joshua Bloch (http://java.sun.com/features/ 2003/05/bloch_qa.html). As illuminating as the interview was, it left me with a number of questions, so I started to search for answers by reading JSR 201.

If you read this JSR, you'll find that it doesn't include a critical discussion of the proposed changes, nor is there any supporting documentation that includes a record of such a discussion. In fact, I was unable to find a public record of any critical discussion. Surely those discussions took place. What alternatives were proposed and why were they ultimately rejected? Do the proposed changes represent a direction for the evolution of the language? Take autoboxing, for instance. What problem is it trying to solve and is there an alternative that offers a better solution? Here are some thoughts on this point.

Autoboxing is a concise notation for working with instances of the immutable classes that are used to wrap primitive types. It will allow us to replace code such as "new Integer( ((Integer)map.get(key)).getInt() + 1)" with "map.get(key) + 1". While this code is easier on the eye, does this new syntax tackle the fundamental issue that objects and primitive types are like water and oil? They don't mix unless you add an emulsifier. In Java, the emulsifying agents have been wrapper classes, one for each primitive type. As necessary as these wrapper classes are, they do hinder our ability to operate on the underlying primitive unless we resort to the unpleasant-looking code listed above. Instead of solving the problem, wrapper classes have seemingly shifted the problem elsewhere, which resulted in the JCP Expert Group recommending that autoboxing be added to the language. This begs the question: Couldn't we have solved the problem instead of passing it along? If mixing objects and primitives is the problem, it seems reasonable to suggest that we shouldn't mix them. Instead, let's promote primitives to the status of first class objects with all the rights and privileges. In doing so, we would eliminate the need for wrapper classes and, consequently, for autoboxing.

In the past when I suggested that primitives should be promoted, I was told that this would be incredibly inefficient. My counter to this argument focuses on two points. First, being a first class object is a syntactic or notational convenience. The final compiled representation of integers and other primitives could (and should) be the choice of the implementers (sound familiar?). The second point was really in response to the comments about the differences in efficiency between operating on primitive types and on objects. But what of these differences? Do we really have to experience the cost of method lookups for each operation? To this I reply: Java is a typed language. In other words, we are giving the compiler big hints as to what we are doing. The compiler should be able to use these hints to do the right thing. In fact, current compiler optimizations are the result of far more complicated evaluations. One last point: autoboxing is implicitly creating both new objects and garbage. Though this is not bad in itself, it does remind me of the performance problems that can result from using + to simplistically concatenate strings.

I first thought of offering a counterargument to my proposal, but then realized that it's not my role to do so; it's yours. Furthermore, shouldn't it be the role of the JCP to foster healthy debates on all of its proposals so that we, as a community, know and understand that we are getting the best choices possible? After all, we, the average Java developers, are the ones who sit in the trenches of the Java community, and the JCP can only be our process if we all become more involved in it. You can send your comments to the JSR 201 and JSR 215 Expert Groups.

About Kirk Pepperdine
Kirk Pepperdine has more than 10 years of experience in OO technologies. In edition to his work in the area of performance tuning, Kirk has focused on building middleware for distributed applications.

YOUR FEEDBACK
Ploni Almoni wrote: Microsoft, competition - your kiddin' me. What is .NET if not a replica of the Java Environment. Recall what happened to companies that used to compete with Microsoft - WordPerfect, Netscape etc. Microsoft does not create competition it only destroys it (as all Monopolies do).
Ron Hunter-Duvar wrote: You are absolutely right that primitive types should be promoted to first class objects. The efficiency argument is bogus. Both Lisp and Smalltalk treat primitives as first class with no efficiency issues (not that these languages are models of efficiency, but their inefficiencies do not result from their primitive handling), by internally tagging them as primitives. The use of these wrapper classes is far more inefficient, with all the object creation and destruction and wrapping and unwrapping overhead.
J Bammi wrote: I read the whole interview: I live in both the Java and .Net worlds. If i look at the features talked about in the interview, it almost reads like -- lets see what does c# have and Java does not -- lets bring them to the front (modulo generics of course). Sun had their head buried in the sand for over 5 years. .Net just help them pull their heads out (users screaming about these same features were ignored). Bring on the competition!
LATEST JAVA STORIES & POSTS
Parallel programming in Java is becoming easier with tools such as the fork/join framework, Pervasive DataRush, Terracotta, and Hadoop. This article gives a high-level description of each approach, pointing you in the right direction to begin writing parallel applications of your...
"Ruby on Rails is always evolving and has over the past five years gone through some fifty-plus public releases," said David Heinemeier Hansson, creator of Rails and member of the Rails Core Team. "Rails developers need the supporting ecosystem to keep up with that evolution. New...
"The Internet marketplace has evolved within and well beyond the traditional Web browser, fueled by an explosion of Java-powered smart phones and consumer electronic devices from RIM's Blackberry to Amazon's Kindle," said Jonathan Schwartz, CEO & President of Sun, as JavaFX 1.0 w...
Worldwide server shipments might have been up 4.4% to 2.3 million units in the September quarter but revenues were down 5.4% to $12.7 billion according to Gartner. IDC's numbers aren't all that different. It hasn't been this bad since 2002 and IDC for one doesn't expect a rebound...
Unit testing is hard. There I said it. Although I have been developing software for the past 18 years I still find that putting my applications through their paces via unit testing is difficult. I have learned the lesson (I'm sure like many of you) the hard way. Unit testing is p...
Continuent has announced support and enhancements to MySQL Server 5.1.30 GA release, the 5.1 production version of the open source database. MySQL 5.1.30 is recommended for use on production systems by the MySQL build team at Sun Microsystems. Continuent Tungsten provides advance...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

SPONSORED BY INFRAGISTICS
In every field of design one of the first things students do is learn from the work of others. They ...
There are many forces that influence technological evolution. After a decade of building enterprise ...
2008 is going to be an important year for Rich Internet Applications. Most organizations are deliver...
The OpenAjax Alliance is developing an Ajax industry wishlist for future browsers, using a dedicated...
Infragistics announced the availability of two Community Technology Preview (CTP) User Interface (UI...
The YUI development team has released version 2.5.2; you can download the new release from SourceFor...
ADS BY GOOGLE