Sunday, December 19, 2004

Java Tiger and Me !

I had come to java from a smalltalk background. I found a few things very strange.

And now I can see that the there are solutions to what I found strange, back in mar-apr of 2000, in the new Java Tiger release.

Need to cast classes in and out of collections.

I had posted on the java newsgroup. The heading was Casting Classes . Of course the credit for this goes to smalltalk. It is such a superb language.

All that I was saying there is that objects should know who they are when are put in or taken out of collections.

Using Generics for java collections does this very nicely.

But of course my complaint and another aspect , that that was that in totality “Objects should know who they are” . But that issue is one of language itself, being type safe or not, and I have learned to live with java being type safe.

Need to have to use two different artifacts for the same type of thing

Why should there be an int and an Integer at all. I had posted about this as Why the difference between Integer and int ?? in the java newsgroups.

It still seems so illogical to me. Why have primitives at all in an object oriented language. Again this had come from knowing smalltalk.

Now we have something called autoboxing in both java and C#, which helps with just that.

A good article for new features in java is at

http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-tiger1.html

http://www.javaworld.com/javaworld/jw-06-2004/jw-0607-tiger2.html

I will try and post some performance metrics, which will show whether collections are faster with or without generics.

0 Comments:

Post a Comment

<< Home