Java 8 Vs .NET 4.5 – Microsoft hits back!

JAVA 8 VS .NET 4.5 – MICROSOFT HITS BACK!Microsoft .NET vs. Java is an age-old debate that has never been conclusively settled! Both are object-oriented languages with strong roots in C and C++. They both offer a set of standardized, modular components and services that simplify the software development process. The similarities however, end here. There are considerable differences between .NET and Java, and developers need to make serious trade-offs depending on what exactly they want before committing to one. The latest versions – .NET 4.5 and Java 8 accentuate the differences.

Openness of the Code

Java has always been ahead of .NET in popularity, and this is primarily due to its openness and flexibility.

Java is a somewhat of a cross between open source and proprietary. Sun Microsystems released the complete source code of the class library of Java, except some limited parts, under GPL in 2007. Though Oracle owns Java, about 80% of all Java applications are built on open source tools.

.NET is Microsoft all the way, but it too has been opening up, of late. In 2013, Microsoft decided to open source many parts of the code under Apache License. Microsoft has standardized the .NET CLI executable environment and some of the corresponding class library, and allowed free implementation without a license. It has also implemented a few standards-compliant free software environments such as the Mono Project and DotGNU. Microsoft has even announced collaboration with Xamarin to increase cross-platform availability of .NET on Linux, Mac OS, and mobile devices.

The latest .NET Framework 4.5 makes available Microsoft Reference Source website which allows the developer to download or browse the source code online. Also, most .NET projects now co-opt open source extensions along with commercial .NET tools.

Java had a big plus here, in that it allows applications to run on all possible gadgets without the need to rewrite the code. However, Java did not entirely live up to its “write once, run anywhere” promise. This, and the fact that.NET has an ace up its sleeve when it comes to flexibility means that the days of Java’s unbridled popularity may well be over.

The .NET environment allows developers to program in more than 20 languages, including Cobol, and this appeals much to programmers who have worked in legacy environments. The only hitch is the need to run such .NET applications on Microsoft’s Common Language Runtime, and this almost invariably requires heavy infrastructure. Once this stumbling block goes, and Microsoft takes its MonoProject further, it could very well eclipse Java in flexibility.

Third Party Integrations

Java is platform independent, with the developer having the freedom to choose any operating system for production and development. Microsoft’s .NET framework offers features and functionality designed specifically for creating and running applications on the Windows platform, though it does support connectivity with non-Windows systems.

Java offers a host of third party integration tools. Microsoft considers interoperability more important, and offers robust web services to ensure that .NET-based applications share information with applications running on other platforms seamlessly.

While Java works through third-party libraries, Microsoft is constantly working towards offering integrated services. It facilitates inbuilt integration with the likes of SharePoint, MS Exchange and MS Office very early. A big drawback was .NET not having built-in support for implementing Zip compression, forcing developers to use third party components such as “DotNetZip”. .NET 4.5 remedies the shortcoming, with the Zip feature baked in the framework itself. Java 8 has a default Zip library from v7 onwards, but it is bloated and has a bad API design.


Java’s flexibility extends to its Integrated Development Environment (IDE) as well. Developers can pick and choose from the four main IDEs : Eclipse, IntelliJ Idea, Oracle NetBeans, and Oracle JDeveloper, or sundry minor ones. Competition among these IDEs drives innovation and better customer offerings.

.NET developers are tied to Microsoft Visual Studio. This is a robust and comprehensive offering, though. It provides everything that developers needs to develop, debug and deploy most types of applications. It spares developers the hassle of having to evaluate tools and IDEs in advance, as in the case with Java.

Speed and Performance

Whatever .NET suffers in flexibility, it makes up in speed of execution and performance. Java IDEs take their time compiling, whereas Microsoft Visual Studio offers fast turnaround. And, with every new release, Microsoft is increasing the gap. What’s more, the latest .NET 4.5 offers three significant improvements that enhance speed.

.NET 4.5 introduces “async” and “await,” two markers which mark code positions from where control should resume after a task completes. Java does not have an equivalent yet.

The third is the new server garbage collector. Hitherto .NET suffered from a big drawback in that when the automated garbage collector runs for cleanup, all application threads remained suspended, making the server less responsive. Considering that ASP.NET applications run on the server and a lot of clients send requests to the server, the garbage cleanup takes place frequently. This means that holdups were commonplace. .NET 4.5 introduces server garbage collector where the garbage removal thread works in the background. Java 8 offers metaspace that expands at runtime, for garbage collection.

Another big stumbling block was the .NET code running slowly when compiled for the first time. This is because the .NET code is in a half compiled format, and during runtime, the JIT compiler has to run and translate this half compiled code to native machine code. .NET 4.5 introduces “profile optimization” that makes it possible to do the JIT compilation in the background, and across multiple processors, thereby minimizing the startup time considerably. This said, Java 8 also offers several improvements – most notably concurrency updates to improve its ForkJoin feature.


In 2013, Veracode’s State of Software Security found 82% of the tested Java applications having code quality issues, compared with 78% of .NET applications having similar quality issues.

Microsoft’s emphasis on code quality means that it is discovering a lot more vulnerabilities before products ship, and it also has a well-defined process to roll out fixes. Oracle too has a security development lifecycle, but that is not as mature as Microsoft’s.

Also, the latest version allows .NET to inch up further in the security space. “Regex,” the most preferred way to do validations, has a big stumbling block in that its typical parsing logic is exposed to DOS attacks. .NET 4.5 makes it possible to define a timeout property to preempt such attacks. It requires a long code in Java to do likewise.


Java is free and there are many good third-party open source and free Integrated Development Environments (IDEs) as well. The .NET framework is also free, but the only IDE that matters – Microsoft Visual Studio – comes at a cost. However, the fact that Microsoft Windows server operating system ships with a built-in application server, whereas one would have to invest anywhere between $8,000 to $10,000 per CPU to set up a popular Java-based application servers levels the playing field somewhat. Java still has a slight edge here though, as Microsoft Visual Studio requires a higher system configuration compared to even the most resource intensive Java IDEs.

The bottom-line

All things considered, .NET has a clear edge. If nothing else, .NET already has most, if not all, of Java 8 features, and also many features that Java has deferred to its v9. For instance, while Java 8 introduced Lambda expressions, this feature was present in .NET from version 3.0 onwards.

However, this is not to say that developers should always prefer .NET over Java. What works best depends on the situation. For instance, the superior and easier-to-use tools offered by Microsoft give .NET a clear edge over Java for building applications that require rich graphical user interfaces and apps that deliver content to Web browsers. But developers of high volume applications with complex business rules would prefer the high architecture and deep customization offered by Java. Java, for instance, offers more features for session management, fail-over and load balancing than what the Microsoft architecture offers.

With extensive experience in developing applications on both Java and .NET, besides being a Gold Certified Microsoft Partner, we’re best placed to advice you on which to choose. We also have the deep know-how required to migrate legacy systems to the latest versions, as well as integrating a wide array of applications and systems. Do get in touch with us to know more:

Author : Nayab Naseer Date : 01 Jan 2015