Pages

Friday, November 25, 2011

Comparing .Net and Java

Java or .NET?
Over the past several year, we’ve seen the Java platform and the .NET platform continue to converge and the gap between them in terms of features, libararies, and languages continue to shrink. Not only that, but both platforms have to a certain extent been ported from the official version and can run on systems not envisioned by the original designer. Carefully designed ASP.NET applications can run on almost as many platforms as Java with the Mono-based CLR (Common Language Runtime), and its JVM (Java Virtual Machine) counterpart can now run within .NET (or Mono) with the help of IKVM.NET. However, despite all this cross-pollination and convergence between the two platforms there still remain distinct advantages for choosing a certain platform for your next enterprise, web-based, desktop, or mobile application. Compiling a comprehensive list or chart of what makes one platform ideal for a scenario is impossible; however, there are these simple guidelines that can help you start down that path. We’ve broken down the high-level options into six categories, and we’ll discuss the options based on each one next.

Cloud Computing

Although this can usually be considered a subset of the next category (Web 2.0 Applications), cloud computing introduces several new constraints and a paradigm shift in the way development is approached. Microsoft is well aware of these implications and has already invested heavily in technologies that will align .NET more closely with the ideology behind cloud computing. However, the momentum, at least for the moment, is heavily in the favor of the entrenched technologies which are mainly built on top of open source software and commodity hardware. Amazon’s EC2, Google’s App Engine, and Salesforce.com’s Force.com are all built on technologies like Java, Python, and C++ and favor solutions that run on open source operating systems.
As we mentioned, however, Microsoft is not just sitting back and watching this huge market slip away from them, and is working feverishly to bring Azure, its entry into the cloud computing arena, to market. For the time being, however, the winner in this area between the two contestants is Java.

Web 2.0 Applications

As mentioned above, this category shares many of the features of the previous one so we will just mention that the topics of open source virtualization and operating systems still favor Java. There are, however, additional advantages that Java has in this realm, mainly in the form of open source libraries and frameworks that aid in the development of these applications. For example, the Java eco-system has hundreds of web application frameworks, content management systems, ecommerce systems, social network frameworks and so on, with a large amount of them being high quality as well as open source. Two exceptional Web 2.0 frameworks that are used to build successful Web 2.0 applications include JRuby on Rails and Grails.
Also, traditional ASP.NET applications had only one architectural option for build web apps, the classic Page controller pattern. Most interaction between the browser and the server happens through an HTTP POST action and session and page information is stored in a ViewState object that persists on every page. This architectural style creates a heavier load on the server and is more difficult to scale then the share-nothing architecture found in many Web 2.0 applications.
Microsoft has been working on alternative styles of web applications and is close to releasing an MVC architecture style for ASP.NET applications which uses the Front controller pattern found in most Java applications. Java, however, still has the advantage in this category.

Rich Internet Applications

Since the first release of Java in the mid-90s, the Java applet has been hailed as the ultimate platform for applications that can be written-once and run on any platform, easily distributed using a web-browser, and capable of high-quality graphics and animations. However, Sun stumbled early on with it’s browser plugin for the applet, and Java applets became synonymous with slow, buggy, and unwieldy applications. The promise behind them faded and although several really good applications using applets have been released the Java applet platform still hasn’t caught on. Flash became what Java should have been, and developers quickly switched their attention to that environment.
As the important of Rich Internet Applications started becoming apparent, Microsoft decided to take the technology it was building behind XAML and WPF (presentation frameworks for Windows and .NET) and build a Flash/Java killer that would provide all the benefits of Flash on the client side with all the benefits of .NET on the development end. Giving developers the powerful capabilities of Visual Studio and .NET libraries and a high-end graphics and animation framework quickly made Silverlight an important contender in the RIA arena. Although Sun is pouring a large amount of resources in its RIA player, JavaFX, it still remains to be seen whether it will have the success that Silverlight is enjoying, making .NET the winner in this category.

Enterprise Applications

We’ve been noticing a clear trend in many of the enterprise’s IT departments, and several surveys and studies have been confirming this. More enterprises are consolidation on the Microsoft platform, or at least clearly making it an equal partner where it was not a considered option before. From large enterprises to SMBs, IT departments are jumping at the opportunity to consolidate on a single platform for their mail, directory, ERP, CRM, document sharing, and so on. Exchange, SharePoint, Microsoft’s CRM and ERP offerings are becoming semi-standards in many companies and this starts to filter down to the development teams as they start using Visual Studio and .NET for integration and development projects. At the same time, Visual Studio has become an excellent IDE with some of the best support for XML/SOAP/WebServices that is the main glue available for both server to server as well as server to client communications.
Creating desktop applications in Visual Studio is also one of its strong spots, and with the (partially) controlled environment found in the enterprise it’s not a problem to quickly deploy the necessary .NET framework to all clients. With all these advantages, .NET is usually the safe bet for most enterprises and is the winner in this category.

Desktop Applications

As we just mentioned, Visual Studio is a top-notch IDE for building GUIs (graphical user interfaces) and desktop applications, especially with the data binding and component building support in Windows Forms and Windows Presentation Framework. However, there is a an important drawback, these applications (with the exception of those targeting Mono) will only work on Windows machines with the .NET framework pre-installed. For some developers this may be an acceptable assumption, especially if we’re targeting the enterprise as we mentioned above. However, for general purpose applications Java is a better option, considering that it usually comes pre-installed with most operating systems and OEMs, and can be easily installed on virtually any platform if it is not. In the future, Microsoft may extend Silverlight’s functionality with offline support and desktop integration but Java is a better option for now.

Mobile Applications

With the notable exception of Apple’s iPhone, the Java Mobile platform is available on almost every modern mobile device, and despite its fragmented and sometimes inconsistent implementation on the various platforms it’s still considered the one common tool for developers to take advantage of. If you want an application that runs on the most mobile platforms, Java is your platform to get there.

1 comment: