To seasoned Java developers, .NET may seem similar to the Java platform. Both provide a structured way to create applications, both have languages that compile to intermediate code, and both provide a large library of APIs for application development. However, there are significant differences in the platforms.Conceptual Difference
Conceptually, Java is two things: the Java platform (runtime and APIs), and the Java language. The purpose of the Java platform is to support applications written in the Java language and compiled to Java bytecode. Although there have been attempts to compile other languages to Java bytecode, these have largely been academic exercises. The ideal of Java has always been a single language on multiple platforms.
.NET also is two things: the .NET Framework (runtime and APIs), and the plethora of supported programming languages. The purpose of the NET Framework is to support applications written in any language and compiled to MSIL. The goal of .NET is a single platform shared by multiple languages.
This is the primary difference between the two platforms, and its effects are far-reaching.Multi-language
The most obvious difference between the two platforms is the language. If you’re writing to the Java platform, you’re writing code in Java. Period. The Java Virtual Machine was designed to execute Java code and although there have been attempts to port other languages to the JVM, those efforts have not been widely accepted or completely successful. .NET applications, on the other hand, can be written in any language that supports .NET. The .NET Framework SDK ships with three languages: C#, Visual Basic .NET, and Jscript .NET. Microsoft also offers J# .NET and C++ with managed extensions. Third party languages include COBOL, Eiffel, Perl, Python, Pascal, and many others. There currently are over 20 languages that support .NET. And because they all target the Common Language Runtime, programs written in any of these languages can access objects created by any of the other languages.Framework Classes
Because Java is multiplatform, the set of framework classes has traditionally been limited to what is available on all platforms. This affects both the scope and richness of classes, both of which are limited to the lowest-common denominator of available computers and operating systems. The built-in Java classes are typically very simple and developers often build their own frameworks on top of them, or have to find third-party frameworks.
The .NET Framework is built upon the Windows platform, and the .NET Framework classes offer the full scope of what is available on this platform. Additionally, the classes are richer than what is available in Java: .NET provides a programming framework rather than a base on which to build a programming framework.
A typical example of the difference between Java framework classes and .NET framework classes is in the area of forms packages. The .NET Web Forms classes provide a much richer environment than either of the two competing Java forms packages (AWT – Abstract Windowing Toolkit, or Swing).Write Once, Debug Everywhere
While the Java ideal of “write once, run anywhere” is attractive, most applications written today target only one operating system. There are two technical reasons for this:
1. Because the Java framework is limited in scope and richness, developers often use proprietary classes to access
features available to the target platform.
2. Because lingering incompatibilities between the various Java implementations have continued to plague true
cross-platform efforts, developers must test their code on every platform they wish to support. Because of this,
some developers have half-jokingly referred to Java as the “Write once, debug everywhere” platform.Security
Security is richer in .NET. Along with APIs for cryptography, secure cookies, and authentication, there is also a rich and extensible mechanism for assigning different levels of permissions to different sets of users, based on where the code came from. For example, you can mark all code from a particular vendor as safe. All code from a specific URL can be granted (or denied) read/write access to specific resources such as the temp directory or screen. In addition, applications can be marked as requiring certain permissions (for example, requires access to the file system). If these permissions are not available, then the application will not load. Because the security check is performed at load time, the developer is freed from writing security fail detection logic throughout the application. This is managed through a new technology called “code access security,” which works for code loaded from either the Internet or the local machine.Versioning
The .NET Framework has a more robust versioning system than Java. In Java, if two versions of the same class are installed, the Java runtime will simply load the first class it finds on the classpath, ignoring the version. In contrast, .NET is designed for rich version support. With side-by-side execution, two or more different versions of the same class can be loaded and executed at the same time. Each application can choose its binding mechanism: whether to bind to a specific version of a class library, the most recent version of the library, or the version in a particular location. In addition, policy can be applied on a machine-by-machine basis to override or further refine version control. This attention to versioning continues into the programming languages. For example, in the C# language, methods are nonvirtual by default, and developers must explicitly declare overridden methods. This means components cannot accidentally break behavior in base classes. C# doesn’t require the developer to explicitly declare which exceptions a method can throw: If the exception list changes, client code will still work.Performance
Where .NET outshines Java is in the ability to fine-tune application behavior and performance. The core application building blocks are designed for scalability and high throughput. For example, with ADO.NET disconnected data access, more data functions can be completed in-memory, which in Java Database Connectivity (JDBC) require a round trip to the database. In addition, the .NET application architecture is designed to be faster. For example, ASP.NET Web pages provide a huge performance improvement over Active Server Pages (ASP), Java Server Page (JSP), and HTML embedded script languages. When compared to the JSP platform, .NET performance is not only better in single-user scenarios, but also in massively multi-user scenarios.
Other Web Source
*** Please do not forget to leave your comments about this article ***