Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 1 - Robert Simpson
Source Paper: http://www.ondotnet.com/pub/a/dotnet/2001/06/14/csharp_4_java.html
After inquiring about the differences between C# and Java I found that some of it lies in the extension of primitive types. In Java primitives are the smallest “unit”, but thus do not extend from anything. Where as everything else in Java extends from java.lang.Object. However, in C# a primitive integer extends from System.Object. This makes them available to any object, unlike in Java where objects and primitives can not explicitly communicate. So even though these primitive types are objects they are passed by value, not reference. In Java they are also passed by value, but if, for instance, someone simply wrote them into java.lang.Object they would have to be passed by object reference. This will help a programmer interact with primitive types and Objects and gives C# a distinct advantage when writing new Object types. There is also a difference in the way variables can be pronounced a constant. In Java a variable must be made a static final in order to be class scoped and prevent any changes being made to that variable. In C# the variable can either be const which converts the value and switches it out in preprocessor time, or readonly which allows the value to change between compiles. In either case the variable will never be changed while the application is running. This can change how the programmer writes his code because if he wants a faster run time and no changes to be made between compiles he can simply use const. This gives more flexibility and control to the programmer over using Java’s static final.
I read Brian Smith’s discussion about the creation of the languages C, C++, C# and Java. Unlike my paper his was much more broadly based and spoke mostly about the history of each language’s birth. He mentions a few distinct similarities between C# and Java which is what the article I read outlined. However, the similarities I found between them were looked at on a much finer level and found to be very different, effecting individual coding styles of each.
Links to this Page