The purpose of this post is the answer the age old question “Should I use Java or .NET?” What are the advantages of each? What are the disadvantages of each? How should corporations decide which platform to use?
.NET platform
.NET applications are built by developing in any of the .NET languages such as C#, VB, or C++, which is then compiled into the CIL (Common intermediate language) byte-code. Next, the CIL is converted into assembly which can then be executed on any Windows machine.
Java platform
J2EE applications are built by developing in Java only, which is then compiled into Java byte-code. The intermediate byte-code is then converted to assembly using the JVM (Java Virtual Machine). Unlike the .NET platform, however, the assembly code created from the JVM can run on any platform, including Windows, Unix, Solaris, or Mac OS.
Platform dependency
The major difference between Java and .NET is their platform dependencies. .NET applications can only be run on Windows, while Java applications can be run on any machine.
Cost
The next major difference between Java and .NET is cost. Since Java is open source, it’s completely free to develop and deploy Java applications. It’s most popular IDEs like Eclipse and JBuilder are also free. Furthermore, since Java applications are platform independent, they can be ran on UNIX machines, which is a free OS. Essentially, the only cost associated with running Java programs would be the cost of hardware.
.NET applications, on the other hand, can only run on Windows machines, so Windows Server licenses will need to be purchased. Unlike the Java platform which leverages free IDEs, .NET applications are built with Visual Studio, which is also requires a paid license.
As a result, small companies and startups are much more likely to have J2EE frameworks than .NET frameworks simply because it’s 100% free to develop Java applications.
Corporate infrastructure
Unfortunately, whether to choose the .NET platform or the Java platform isn’t always under your control. In the corporate world, it’s very common for corporations to acquire other companies. As a result, even if the corporation in question was originally built on a Java platform running on all UNIX machines, after a number of acquisitions that same company might now have a whole farm of UNIX, Solaris, and Windows machines. In other words, larger corporations tend to be made up of both Java and .Net applications. This isn’t necessarily a bad thing, but it sure can complicate your IT department!
Interoperability
This is sometimes an overlooked topic in the Java vs .NET debate – .NET applications can theoretically be written in many different languages, including C#, VB, and C++ to name the major ones. On one hand, this might provide you with the flexibility to hire programmers with different skill sets, allowing say a C++ developer to build certain portions of an application, and a C# developer to build other portions of an application. Like any double edged sword, however, this can cause problems with maintainability. The more languages that your application is built in, the harder it will be to keep the correct proportion of developers with each skill set to maintain the code when changes need to be made.
Java applications, as mentioned before, are only developed in Java. This means that you won’t ever have the problem of training your developers in different languages, spending your company’s time and money. It also makes the scalability of your applications much easier to handle, because if you need more developers, you simply hire more Java programmers.
GUI
Another difference between .NET and Java is the way that GUIs (Graphical User Interfaces) are handled. .NET GUIs are somewhat easier to develop because they can directly access the graphical components of the Windows OS. Although Java Swing and SWT (Standard Widget Toolkit) enable developers to create GUI elements on any platform, it is somewhat more cumbersome to manage than .NET
RIA dependencies
Finally, another difference to take into consideration is the emergence of new RIA (Rich Internet Application) technologies like Adobe Flex, Microsoft Silverlight, ICEfaces, and Javascript libraries like jQuery, YUI, and ExtJS.
If you’re building web applications using Adobe Flex or ICEfaces, you’ll need the Java platform. If on the other hand you want to develop RIA applications using Silverlight, you’ll have to use the .NET platform. If your web applications will be built using a Javascript library like jQuery, either platform will be just fine!
Conclusion
The reason that the Java vs .NET debate continues to rage on is simply because both platforms are excellent. There’s nothing that one platform can do that the other can’t do. But, under the certain circumstances explained above, it is sometimes advantageous to choose one over the other.