Dot Net vs. Java
There are many controversies as regards the difference between Dot Net and Java. There are basically two environments for fielding application for the World Wide Web as it remains today. They are called Java Platforms and .NET platform. If you devote a considerable amount of time exploring the environments then you can easily see that .NET is far more efficient and perfect than any others and in the competition it can be ranked in the group of first three.
.Net and Java as extensively used development environment for construct web applications:
.Net and Java are said to be the two extensively used development environment to construct web applications. It is very hard to predict as to who will appear the winner, but the clear sign is there that the large enterprises who have been using Java for a prolonged period of time or the enterprises who use different platforms, will certainly continue their relationship with Java. As far as .Net is related, the enterprises who have Windows platform and who is seeking faster development time will go for .Net. With Microsoft based solutions like .Net there is a restricted possibility for scalability for huge scale deployments than it does with any Java application. Furthermore, today if you select any Microsoft based solution you select the hardware without reservation, operating systems, and middleware. This is in difference with the Java, which is autonomous of any operating system and middleware.
Java used as cross platform because of Java Virtual Machine (JVM):
Java is generally used cross platform because of Java Virtual Machine (JVM). JVM helps in the translation of the code to bytecodes and then complies it to machine code according to the operating system. In the same way, now, .Net has developed Common Language Runtime (CLR) engine that converts the program code into Microsoft Intermediate Language (MSIL) and then “just in time” the MSIL is translated to the native code. .Net is now able to support more than 20 languages. It has in built data types in classes known as Common Type System (CTS) that mechanically understands the types of other languages and implements simultaneously. Therefore, when .Net supports numerous programming environment, Java, alternatively, we can say that it is focused on only one programming language that supports multiple environments.
Thus, it is very difficult to argue which platform is finest unless the enterprises appreciate their needs. By and large, these two platforms are here to stay as prospective e business development environments. .Net Development will influence on Rapid Application Development (RAD) solutions, while Java will rule the large scale “enterprise” projects.
CsharpLanguage and JavaLanguage:
- Both have single ImplementationInheritance and multiple InterfaceInheritance.
- Both have automatic GarbageCollection.
- There is a broad overlap of common operators and keywords (41 of 43 operators; 38 of 50 keywords, 46 if you allow for synonyms).
- Java is defined through the JavaCommunityProcess. C# is an ECMA standard.
- PassByReference
- Java only has CallByValue.
- C# has CallByValue and CallByReference. CallByValue is the default. Marking a parameter with the ref keyword indicates that it is passed by reference. Marking a parameter with the out keyword indicates that it is returned from the method.
- Delegates
- More powerful than FunctionPointers (which don't exist in Java).
- Represents a bound method with a given signature and invokes it polymorphically.
- C# has a built-in delegate mechanism.
- Java uses AnonymousInnerClasses for the same uses
- Described as "fully object-oriented", which is a totally meaningless statement. Anonymous inner classes are arguably more "object oriented" than delegates.
- See http://www.onjava.com/pub/a/onjava/2003/05/21/delegates.html for delegates in Java.
- MicrosoftWindowsApi
- It may be easier in C# to design for Windows.
- This may not be a universal advantage.
- OperatorOverloading
- C# can overload some operators.
- The C# String type has its == operator overloaded to provide value semantics.
- When you overload ==, and != will work as expected.
- When you overload ++, both prefix and postfix forms work as expected.
- switch on "strings"
- This can be done in Java using a series of if () {} else if () statements.
- GoTo
- C# has it; Java doesn't.
- Does C# have labelled breaks? No, break and continue can't have a label.
- struct
- In C#, a struct is a ValueObject allocated on the stack.
- You can use NullableTypes to allow such types to support null values.
- Java has no analogue at the language level but the JVM is able to allocate objects on the stack when it determines that they do not live longer than the method activation that creates them.
- Preprocessor
- C# has a preprocessor similar to the CeePreprocessor.
- You can't do some things like #define private public. It's simply a means to create symbols for conditional compilation.
- Attributes
- Allow you to embed meta-data in the compiled binaries.
- This is an enhancement of reflection.
- Attributes were introduced in C# but are now also supported in Java 5.
- Calling native code
- In Java, use JavaNativeInterface or a third-party enhancement to JNI.
- In C#, use P/Invoke. See http://www.ondotnet.com/pub/a/dotnet/2002/02/18/cominterop.html
- ExceptionHandling
- In Java, most application exceptions are CheckedExceptions; however, RuntimeExceptions and Errors are UncheckedExceptions.
- C# uses UncheckedExceptions.
- ExceptionHandling is a little looser in C# than in Java, without the need to declare thrown exceptions or catch those declarations. There is a still an exception-based error handling system; it's just more implicit than explicit. -- BrettMcNamara
- Properties
- In Java, getName and setName are methods for manipulating properties, per JavaBeans.
- In C# the property Name wraps get and set methods and is explicitly defined as a property.
- (Contributors: BrettMcNamara)
- Properties can be little misleading, though, as they can be mixed with data members within methods of same class. (For other classes, this is not a problem because there should be no public data members.) One can easily create a property that performs a HTTP request to return value, somehow forget that it's not a data member, and then wonder why performance is so bad. To some extent, this can be fixed by profiling, but anyway that's unpleasant. (See also SyntacticallyEquivalentMembersAndProperties)
- Both languages support BoxingConversions.
- C# autoboxes values to heap-allocated values of the same type.
- Java autoboxes values to heap-allocated objects of a different type. This complicates reflective code.
- Closures
- Java has AnonymousInnerClasses.
- C# has AnonymousMethods.
- InnerClasses
- Java has both static and instance InnerClasses.
- C# only has static InnerClasses.
- EnumeratedTypes
- C# has enumerated types similar to those in CeePlusPlus. Each enumerated value resolves to an integer constant.
- Java's enumerated types are actually immutable classes. Each enumerated value is an immutable object, complete with polymorphic methods.
- Events
- C# has language support for publish/subscribe style events
- Java uses coding conventions to implement publish/subscribe events with listener interfaces and methods to add and remove listeners.
- Generics
- C# has real generic types: generic types exist at compile time and at runtime.
- Java generic types are compiled away: only non-generic types exist at runtime.
No comments:
Post a Comment