A programmer's tale

Tuesday, November 28, 2006

New and Stylish java coding: Joshua way

Few days ago, JavaOne 2006 sessions are uploaded and updated. They have announced the Rock Star Speakers in this conference. The Rock Stars are:

Session Title and Honored Speakers:

Introduction to AJAX
Dion Almaer, Ajaxian, Inc.
Ben Galbraith, Consultant


The Continuing Adventures of JavaTM Puzzlers: Tiger Traps
Josh Bloch, Google, Inc.
Neal Gafter, Google, Inc.


Extreme GUI Makeover: Lookin' Better
Scott Violet, Sun Microsystems, Inc.
Romain Guy, Sun Microsystems, Inc.
Shannon Hickey, Sun Microsystems, Inc.

Crazy Talk: Examining Why Agile Software Development Works
Scott Ambler, AmbySoft

Extreme Web Caching
Jason Hunter, Mark Logic

Twelve JavaTM Technology Security Traps and How to Avoid Them
Brian Chess, Fortify Software

Effective JavaTM Reloaded
Josh Bloch, Google, Inc.

The Top 10 Ways to Botch an Enterprise JavaTM Technology-Based Application
Cameron Purdy, Tangosol, Inc.

Groovy = JavaTM Technology + Ruby + Python for the JVM
Rod Cope, OpenLogic, Inc.

Eight Ways to Be More Productive Developing Swing Applications
Ben Galbraith, Consultant

User Interfaces in XML: The JAXX Framework
Ethan Nicholas, Yahoo! Inc.

JavaTM Technology Techniques for Developing AJAX Applications
Bruce Johnson, Google, Inc.
Joel Webber, Google, Inc.


To Know the Dependencies is to Understand the Architecture
Neeraj Sangal, Lattix, Inc.

Simpler, Faster, Better: Concurrency Utilities in JDKTM Software Version 5.0
Brian Goetz, Quiotix Corp.
David Holmes, Sun Microsystems, Inc.


Troubleshooting JavaTM ME Technology: Tips from the Pros
Rodney Aiglstorfer, mfoundry

The JavaTM Memory Model: The Building Block of Concurrency
William Pugh, University of Maryland
Jeremy Manson, Purdue University


Swing Threading 101: An Introduction to the Event Dispatch Thread
Scott Delap, Software Consultant
Scott Gelb, BJC HealthCare


I’m always a fan of Joshua Bloch (Josh). And his session attracted me mostly. I have already read his masterpiece Effective Java. But in this current session he gave us more ammo of Java.

Here I’m giving one example:

For writing generics, we have to write the type two times like:

List<String> strList = new ArrayList<String>();

Here, String is to be mentioned twice.

Ok, still not convince then look at the pain of generics like:

Map<String, Map<String, List<String>>> mp = new HashMap<String, Map<String, List<String>>>();

It would be more better if we had method like this:

List<String> strList = ArrayList.newInstance();
or
Map<String, Map<String, List<String>>> mp = HashMap.newInstance();


Unfortunately these are not available JDK yet.
But writing the desired functionality is not hard at all. I’ve written my own utility class for that. I just use that as following way:

List<String> strList = Lists.arrayList();

Map<String, Map<String, List<String>>> mp = Maps.hashMap();

This is called type inference of generics in java.

Effective Java, Volume-2 will be published on the next year ending.