There have been some publications about .NET and Java. Microsoft published a paper showing how to convert from Java to .NET. Here are my thoughts on the differences between the two “platforms”.
Why Java and .NET
Java is the technical foundation of many components of the NetWeaver platform, to name a few:
- WebAS for Java
- NetWeaver Development Studio
- Enterprise Portal, PDK
- Parts of XI
.NET is a technology platform marketed by Microsoft. Because Microsoft is a global player and can be seen as being able to penetrate the market resp. influencing desires, it is important for another global layer like SAP to support technologies coming from Microsoft. .NET is supported by NetWeaver, e.g. it is possible to call .NET components.
Differences between Java and .NET
Maturity versus innovation
Not being a .NET idolizer, I still would allow myself to say that .NET offers several innoations, some of them described later on. Java is also seen as innovative as it was the first popular language purely implementing OO principles (besides some very few exceptions existing for performance and usability reasons). But for Java we can speak of a mature solution, .NET still has to prove.Take Robocode for example, for which even a genetic algorithm is available in Java to evolve robot programs!
One language vs. language integration
Both languages are based on the principle of object-orientation. To be exact, .NET is not a language. It is a platform integrating several languages like (in no special order):
- C# (C-Sharp)
- Visual Basic .NET
- Managed C++
Java itself is a language and it is only one language. That is a big difference to .NET. Java could be seen as a “platform”, too, if taking the tools, libraries, IDEs, JSR’s etc. into account. But mainly, people speak of a language when talking about Java.
Java does not support versioning of class files explicitely. You have to care for yourself to provide the correct version of the classes and libraries to be used.
In .NET there exists a Global Assembly Cache (GAC). The GAC offers you the possibility to explicitely decide which version of a library you want to use.
To develop Java applications you can use any development environment (IDE) available. There are plenty of popular IDE’s for Java, many of them completely free.
Microsoft provides its own IDE for coding .NET applications. To my knowledge it is called “Visual Studio .NET 2003” (planned is “Visual Studio .NET 2005”, codename “Whidbey”). Additionally, there will be Visual Studio code name “Orcas” for the Windows operating system with code name “Longhorn”.
I assume that there are or will be other third-party IDE’s for .NET as well. But as .NET is sort of a young technology it will take some time to close the gap to the broad variety Java offers.
Annotations vs. Attributes
In my recent weblog entry, I discussed annotations for Java. The similar concept in .NET is called Attributes. With an attribute you can mark a normal method as being a web service. The difference to Java annotations is the immediate impact on the code. Java annotations offer a more meta data centric approach, whereas .NET attributes allow to modify the code base.
Java provides JDBC to connect to many databases. JDBC is similar to ODBC from Microsoft. In .NET the database connectivity is done via ADO.NET which in turn is comparable to JDBC and ODBC. I have no relevant practical experience with ADO.NET and cannot judge over it. I assume that Microsoft offers an acceptable solution with ADO.NET as persistence plays a fundamental role within a framework.
Java and .NET are sort of similar approaches within the OO world. Chose your vendor, would be the decision to make. There are not too many differences although some major differentiators exist. I personally don’t like being dependent on the goodwill of a commercial player like Microsoft. Java seems to me the better alternative because of its maturity, its openness and because it’s easy to go (without downloading zillions of libraries and runtimes as this is the case with .NET, just watch your Windows 2000 and XP update suggestions!).