Monday, October 04, 2004

A Java Prayer

Java 2 Platform Standard Edition 5.0 is (finally) out. The J2SE 5.0 is a major feature release with Performance Enhancements and additions/changes have been made to Java Language Features, Virtual Machine, Base Libraries, Integration Libraries, User Interface, Deployment, Tools and Tool Architecture and OS & Hardware Platforms.

The J2SE 5.0 (code named Tiger) has introduced Language features like Generics which will also be included in C# 2005 (code named Whidbey). Java generics is based on Erasure (generic type information is present only at compile time, after which it is erased by the compiler) while C# implements generics using Reification. Reification seems to be a better way to do it, but Sun used the Erasure approach to provide total interoperability between generic code and legacy code that uses non-parameterized types. But the disadvantage is that parameter type information is not available at run time, and that automatically generated casts may fail when interoperating with legacy code. Many a heated discussions have been made on this design choice. Check these out

Other language features include
Enhanced for Loop
Autoboxing/Unboxing
Typesafe Enums
Varargs
Static Import
Metadata (Annotations)
See Sun's website for more details

C# already have for-each looping,autoboxing/unboxing and typesafe enums. The main language features in C# 2005 are
Generics
Partial types
Anonymous Methods
Iterators
Alias Qualifier (Global Namespace Qualifier)
Static classes
See MSDN for more details

An interesting observation is that C# now added iterators (it already has a for-each loop) while Java now added a for-each loop (it already has iterators).

Refactoring tools available to Java programmers in tools like IDEA are now also available for C# programmers in C# Whidbey IDE (atlast !). With this and many other additions, but I am sure that Visual Studio beats every Java IDE out there. With .NET growing into a powerful and stable platform, Java people need a prayer :


import org.religion.*;

public class LordsPrayer
{
public void pray()
{
// Our Father, who art in heaven,
//
God ourFather = Heaven.getGodInstance();

// Hallowed be thy Name.
//
ourFather.getName().setHallowed( true );

// Thy kingdom come.
//
ourFather.getKingdom().setWelcome( true );

// Thy will be done in earth
// As it is in heaven.
//
boolean isWillDone = Heaven.isWillDone( ourFather );
Earth.setWillDone( ourFather, isWillDone );

// Give us this day our daily bread.
//
Bread dailyBread = ourFather.getBread( new Date() );

// And forgive us our trespassess,
// As we forgive those who trespass against us.
//
synchronized
{
ourFather.forgive( this.getTrespasses() );
this.forgive( this.getTrespassers() );
}

// And lead us not into temptation;
// But deliver us from evil:
//
ourFather.removeTemptationListener( this );
ourFather.deliverFrom( Evil, this );

// For thine is the kingdom, and the power,
// and the glory, for ever.
//

for (;;)
{
Kingdom.setOwner( ourFather );
Power.setOwner( ourFather );
Glory.setOwner( ourFather );
}

// Amen.
//
finalize();
}
}


By the way, new additions to my music collection are :
Heart - The Essential Heart (2 CDs)
Interpol - Antics
Mark Knopfler - Shangri-La
Zucchero - Zucchero and Co
Phil Collins - Love_Songs (2 CDs)
Santana - Jam






2 Comments:

Anonymous Anonymous said...

Refactoring tools available to Java programmers in tools like IDEA are now also available for C# programmers in C# Whidbey IDE (atlast !). With this and many other additions, but I am sure that Visual Studio beats every Java IDE out there.
Why?!!With .NET growing into a powerful and stable platform, Java people need a prayer :
Troll!!Cheerio,
Binil

PS : Is there anyway to make comments come up in the same font as the one in which the blog is written in?

10/04/2004 02:41:00 PM  
Anonymous Anonymous said...

Sorry for the horrendous formatting! The "preview" mislead me :(

Cheerio,
Binil

10/04/2004 03:30:00 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home